예제 #1
0
파일: monsters.py 프로젝트: Lou3797/pyrouge
def generate_monster(map, x, y, id):
    if id is Monsters.PLAYER:
        return Entity(
            "player", {
                Components.READS_INPUT: ReadsInput(),
                Components.POSITION: Position(x, y, True),
                Components.ICON: Icon('@', render_order=Render_Order.ACTOR),
                Components.MOVABLE: Movable(),
                Components.FOV: FOV(map, 8, True, 1),
                Components.ABILITY_SCORES: Ability_Scores(),
                Components.FIGHTER: Fighter(),
                Components.HITPOINTS: Hitpoints(10)
            })

    if id is Monsters.KOBOLD:
        return Entity(
            "kobold", {
                Components.POSITION: Position(x, y, True),
                Components.ICON: Icon('k', tcod.orange, Render_Order.ACTOR),
                Components.MOVABLE: Movable(),
                Components.FOV: FOV(map, 10, algorithm=1),
                Components.ABILITY_SCORES: Ability_Scores(),
                Components.FIGHTER: Fighter(),
                Components.HITPOINTS: Hitpoints(8),
                Components.AI: AI()
            })
예제 #2
0
def make_player(x: int, y: int, player: Optional[Player] = None) -> List[Any]:
    if player is None:
        player = Player()

    return [
        Display(0x0040),
        player,
        Position(x, y),
    ]
예제 #3
0
def make_healing_potion(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0021,
            color=0xFFFF0066,
            draw_order=-1,
        ),
        Item(name="healing potion", ),
        HealingPotion(),
        Position(x, y),
    ]
예제 #4
0
def make_fire_scroll(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x003F,
            color=0xFFFF6600,
            draw_order=-1,
        ),
        Item(name="fire scroll", ),
        FireScroll(),
        Position(x, y),
    ]
예제 #5
0
def make_trap(x: int, y: int, factory: Callable[[int, int],
                                                List[Any]]) -> List[Any]:
    return [
        Display(
            code=0x005E,
            color=0xFF999999,
            draw_order=-2,
        ),
        Trap(factory),
        Position(x, y),
    ]
예제 #6
0
def make_armour(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x005B,
            color=0xFF999999,
            draw_order=-1,
        ),
        Item(name="armour upgrade", ),
        Equipment.ARMOUR,
        Position(x, y),
    ]
예제 #7
0
def make_weapon(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0029,
            color=0xFF999999,
            draw_order=-1,
        ),
        Item(name="weapon upgrade", ),
        Equipment.WEAPON,
        Position(x, y),
    ]
예제 #8
0
def make_teleport_scroll(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x003F,
            color=0xFF6600FF,
            draw_order=-1,
        ),
        Item(name="teleport scroll", ),
        TeleportScroll(),
        Position(x, y),
    ]
예제 #9
0
def make_smoke_bomb(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0021,
            color=0xFF00FF66,
            draw_order=-1,
        ),
        Item(name="smoke bomb", ),
        SmokeBomb(),
        Position(x, y),
    ]
예제 #10
0
def make_officer(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0034,
            color=0xFFFFFF00,
        ),
        Monster(
            name="junior officer",
            threat=[3],
            defend=4,
            health=2,
        ),
        Position(x, y),
    ]
예제 #11
0
def make_defender(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x006B,
            color=0xFF00FF00,
        ),
        Monster(
            name="knight",
            threat=[2],
            defend=4,
            health=1,
        ),
        Position(x, y),
    ]
예제 #12
0
def make_elite_officer(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0033,
            color=0xFFFFFF00,
        ),
        Monster(
            name="senior officer",
            threat=[6],
            defend=5,
            health=3,
        ),
        Position(x, y),
    ]
예제 #13
0
def make_soldier(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0073,
            color=0xFFFFFFFF,
        ),
        Monster(
            name="soldier",
            threat=[2],
            defend=1,
            health=1,
        ),
        Position(x, y),
    ]
예제 #14
0
def make_assassin(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0063,
            color=0xFF666666,
        ),
        Monster(
            name="cutthroat",
            threat=[5],
            defend=1,
            health=1,
        ),
        Assassin(),
        Position(x, y),
    ]
예제 #15
0
def make_elite_soldier(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0053,
            color=0xFFFFFFFF,
        ),
        Monster(
            name="elite soldier",
            threat=[5],
            defend=2,
            health=2,
            article="an",
        ),
        Position(x, y),
    ]
예제 #16
0
def make_elite_defender(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x004B,
            color=0xFF00FF00,
        ),
        Monster(
            name="elite knight",
            threat=[5],
            defend=5,
            health=2,
            article="an",
        ),
        Position(x, y),
    ]
예제 #17
0
def make_archer(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0061,
            color=0xFF00FFFF,
        ),
        Monster(
            name="archer",
            threat=[2, 5],
            defend=1,
            health=1,
            article="an",
        ),
        Position(x, y),
    ]
예제 #18
0
def make_elite_assassin(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0043,
            color=0xFF666666,
        ),
        Monster(
            name="elite cutthroat",
            threat=[8],
            defend=2,
            health=2,
            article="an",
        ),
        Assassin(),
        Position(x, y),
    ]
예제 #19
0
def make_mid_boss(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0032,
            color=0xFFFFFF00,
        ),
        Monster(
            name="militia commander",
            threat=[9, 5],
            defend=4,
            health=4,
            article="the",
        ),
        Position(x, y),
        Boss(),
        CanTaunt(),
    ]
예제 #20
0
def make_end_boss(x: int, y: int) -> List[Any]:
    return [
        Display(
            code=0x0031,
            color=0xFFFFFF00,
        ),
        Monster(
            name="militia captain",
            threat=[11, 5],
            defend=5,
            health=5,
            article="the",
        ),
        Position(x, y),
        Boss(),
        CanTaunt(),
    ]
예제 #21
0
def move(position: Position, target: Tuple[int, int]) -> None:
    x, y = target
    position.x = x
    position.y = y
예제 #22
0
def make_stairs(x: int, y: int) -> List[Any]:
    return [
        Display(0x003E, draw_order=-2),
        Stairs(),
        Position(x, y),
    ]
예제 #23
0
파일: test.py 프로젝트: Lou3797/pyrouge
from ecs.system import System, ObserverSystem
from ecs.components.position import Position
from ecs.components.icon import Icon
from ecs.components.movable import Movable


class TestObersverSystem(ObserverSystem):
    def __init__(self):
        super().__init__(Components.POSITION, Components.MOVABLE)

    def process(self):
        return


char1 = Entity("test1", {
    Components.POSITION: Position(0, 0),
    Components.MOVABLE: Movable()
})
char2 = Entity(
    "test2",
    {
        Components.POSITION: Position(0, 0),
        # Components.MOVABLE: Movable()
    })
char3 = Entity(
    "test3",
    {
        # Components.POSITION: Position(0, 0),
        # Components.MOVABLE: Movable()
    })
chars = [char1, char2, char3]