コード例 #1
0
ファイル: card.py プロジェクト: townie/mtg-python-engine
    def __init__(self,
                 characteristics=gameobject.Characteristics(),
                 controller=None,
                 owner=None,
                 zone=None,
                 previousState=None):

        super(Card, self).__init__(characteristics, controller, owner, zone,
                                   previousState)

        self.attributes = Attributes()
コード例 #2
0
def create_token(attributes,
                 controller,
                 num=1,
                 keyword_abilities=[],
                 activated_abilities=[]):
    if isinstance(attributes, str):
        if creature_token_pattern.match(attributes):
            pt, color, *c_type = attributes.split(' ')
            p, t = map(int, pt.split('/'))
            types = [cardtype.CardType.CREATURE]
            if 'artifact' in c_type:
                types.append(cardtype.CardType.ARTIFACT)
                c_type.remove('artifact')
        else:
            p, t = None, None
            color, *c_type = attributes.split(' ')
            types = [cardtype.CardType[c_type.pop().upper()]]

        color = {
            'colorless': 'C',
            'white': 'W',
            'blue': 'U',
            'black': 'B',
            'red': 'R',
            'green': 'G'
        }[color]

        name = ' '.join(c_type)

        print("making token... %s" % attributes)

        if isinstance(keyword_abilities, str):
            keyword_abilities = [keyword_abilities]
            print("with %s" % ' '.join(keyword_abilities))

        for ablty in activated_abilities:
            ablty[0] = utils.parse_ability_costs(ablty[0])

        for i in range(num):
            characteristics = gameobject.Characteristics(
                name='Token: %s' % name,
                types=types,
                power=p,
                toughness=t,
                subtype=c_type,
                color=[color],
                abilities=[
                    static_abilities.StaticAbilities[a]
                    for a in keyword_abilities
                ])

            Token(characteristics, controller, activated_abilities)
コード例 #3
0
 def __init__(self):
     super(c230762, self).__init__(gameobject.Characteristics(**{'text': 'Target creature gets +3/+0 and gains first strike until end of turn. (It deals combat damage before creatures without first strike.)', 'mana_cost': '2R', 'name': 'Slaughter Cry', 'color': ['R']}, supertype=[], types=[cardtype.CardType.INSTANT], abilities=[]))
コード例 #4
0
 def __init__(self):
     super(c2473, self).__init__(gameobject.Characteristics(**{'text': "Enchant creature\nAt the beginning of the upkeep of enchanted creature's controller, that player may pay {3}. If he or she doesn't, Mind Whip deals 2 damage to that player and you tap that creature.", 'mana_cost': '2BB', 'name': 'Mind Whip', 'color': ['B'], 'subtype': ['Aura']}, supertype=[], types=[cardtype.CardType.ENCHANTMENT], abilities=[]))
コード例 #5
0
 def __init__(self):
     super(c21190, self).__init__(gameobject.Characteristics(**{'text': "Enchant creature\nEnchanted creature gets +1/+3.\n{W}: Return enchanted creature to its owner's hand.", 'mana_cost': '1W', 'name': 'Sun Clasp', 'color': ['W'], 'subtype': ['Aura']}, supertype=[], types=[cardtype.CardType.ENCHANTMENT], abilities=[]))
コード例 #6
0
 def __init__(self):
     super(c179594, self).__init__(gameobject.Characteristics(**{'power': 3, 'mana_cost': '2(U/R)B', 'color': ['U', 'B', 'R'], 'text': 'Flying, haste', 'toughness': 1, 'name': 'Sewn-Eye Drake', 'subtype': ['Zombie', 'Drake']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[static_abilities.StaticAbilities.Flying, static_abilities.StaticAbilities.Haste]))
コード例 #7
0
 def __init__(self):
     super(c34243, self).__init__(gameobject.Characteristics(**{'power': 4, 'mana_cost': '5WW', 'color': ['W'], 'text': "First strike (This creature deals combat damage before creatures without first strike.)\nWhen Ancestor's Chosen enters the battlefield, you gain 1 life for each card in your graveyard.", 'toughness': 4, 'name': "Ancestor's Chosen", 'subtype': ['Human', 'Cleric']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[]))
コード例 #8
0
 def __init__(self):
     super(c370698, self).__init__(gameobject.Characteristics(**{'power': 2, 'mana_cost': '2B', 'color': ['B'], 'text': 'Sacrifice another creature: Blood Bairn gets +2/+2 until end of turn.', 'toughness': 2, 'name': 'Blood Bairn', 'subtype': ['Vampire']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[]))
コード例 #9
0
 def __init__(self):
     super(c193467, self).__init__(gameobject.Characteristics(**{'text': 'At the beginning of your upkeep, if you have exactly 1 life, you win the game.', 'mana_cost': '2WWW', 'name': 'Near-Death Experience', 'color': ['W']}, supertype=[], types=[cardtype.CardType.ENCHANTMENT], abilities=[]))
コード例 #10
0
 def __init__(self):
     super(c19647, self).__init__(gameobject.Characteristics(**{'power': 1, 'mana_cost': 'W', 'color': ['W'], 'text': '{1}{W}{W}, {T}, Discard a card: The next time a source of your choice would deal damage to you this turn, prevent that damage. You gain life equal to the damage prevented this way.', 'toughness': 1, 'name': 'Cho-Arrim Alchemist', 'subtype': ['Human', 'Spellshaper']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[]))
コード例 #11
0
 def __init__(self):
     super(c73960, self).__init__(gameobject.Characteristics(**{'power': 4, 'mana_cost': '2R', 'color': ['R'], 'text': 'When Orcish Paratroopers comes into play, flip it from a height of at least one foot. Sacrifice Orcish Paratroopers unless it lands face up after turning over completely.', 'toughness': 4, 'name': 'Orcish Paratroopers', 'subtype': ['Orc', 'Paratrooper']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[]))
コード例 #12
0
 def __init__(self):
     super(c3610, self).__init__(gameobject.Characteristics(**{'power': 1, 'mana_cost': '1B', 'color': ['B'], 'text': 'When Brood of Cockroaches is put into your graveyard from the battlefield, at the beginning of the next end step, you lose 1 life and return Brood of Cockroaches to your hand.', 'toughness': 1, 'name': 'Brood of Cockroaches', 'subtype': ['Insect']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[]))
コード例 #13
0
 def __init__(self):
     super(c240039, self).__init__(gameobject.Characteristics(**{'text': 'As long as you control exactly one creature, that creature gets +3/+1 and has lifelink.', 'mana_cost': '4B', 'name': 'Homicidal Seclusion', 'color': ['B']}, supertype=[], types=[cardtype.CardType.ENCHANTMENT], abilities=[]))
コード例 #14
0
 def __init__(self):
     super(c226561, self).__init__(gameobject.Characteristics(**{'text': 'Taste of Blood deals 1 damage to target player and you gain 1 life.', 'mana_cost': 'B', 'name': 'Taste of Blood', 'color': ['B']}, supertype=[], types=[cardtype.CardType.SORCERY], abilities=[]))
コード例 #15
0
 def __init__(self):
     super(c233086, self).__init__(gameobject.Characteristics(**{'power': 6, 'mana_cost': '4RR', 'color': ['R'], 'text': '', 'toughness': 4, 'name': 'Flameborn Viron', 'subtype': ['Insect']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[]))
コード例 #16
0
 def __init__(self):
     super(c26805, self).__init__(gameobject.Characteristics(**{'power': 2, 'mana_cost': '2R', 'color': ['R'], 'text': '{T}: Target land becomes a Plains or an Island until end of turn.', 'toughness': 2, 'name': 'Tundra Kavu', 'subtype': ['Kavu']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[]))
コード例 #17
0
 def __init__(self):
     super(c79145, self).__init__(gameobject.Characteristics(**{'power': 2, 'mana_cost': '4W', 'color': ['W'], 'text': 'Flying\nSoulshift 4 (When this creature dies, you may return target Spirit card with converted mana cost 4 or less from your graveyard to your hand.)', 'toughness': 3, 'name': 'Hundred-Talon Kami', 'subtype': ['Spirit']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[static_abilities.StaticAbilities.Flying]))
コード例 #18
0
 def __init__(self):
     super(c74238, self).__init__(gameobject.Characteristics(**{'text': 'Choose an artist other than Rebecca Guay. Target player reveals his or her hand and discards all nonland cards by the chosen artist.', 'mana_cost': '1BB', 'name': 'Persecute Artist', 'color': ['B']}, supertype=[], types=[cardtype.CardType.SORCERY], abilities=[]))
コード例 #19
0
 def __init__(self):
     super(c3060, self).__init__(gameobject.Characteristics(**{'power': 1, 'mana_cost': '1', 'color': [], 'text': '{1}: Choose target opponent. Regenerate Soldevi Sentry. When it regenerates this way, that player may draw a card.', 'toughness': 1, 'name': 'Soldevi Sentry', 'subtype': ['Soldier']}, supertype=[], types=[cardtype.CardType.ARTIFACT, cardtype.CardType.CREATURE], abilities=[]))
コード例 #20
0
 def __init__(self):
     super(c369080, self).__init__(gameobject.Characteristics(**{'text': 'Burn deals 2 damage to target creature or player.\nFuse (You may cast one or both halves of this card from your hand.)\n---\nTarget creature loses all abilities and becomes a 0/1 red Weird until end of turn.\nFuse (You may cast one or both halves of this card from your hand.)', 'mana_cost': '1R', 'name': 'Turn // Burn', 'color': ['R']}, supertype=[], types=[cardtype.CardType.INSTANT], abilities=[]))
コード例 #21
0
 def __init__(self):
     super(c174799, self).__init__(gameobject.Characteristics(**{'power': 3, 'mana_cost': '1R', 'color': ['R'], 'text': 'Trample, haste\nAt the beginning of the end step, sacrifice Hellspark Elemental.\nUnearth {1}{R} ({1}{R}: Return this card from your graveyard to the battlefield. It gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.)', 'toughness': 1, 'name': 'Hellspark Elemental', 'subtype': ['Elemental']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[static_abilities.StaticAbilities.Haste, static_abilities.StaticAbilities.Trample]))
コード例 #22
0
 def __init__(self):
     super(c142027, self).__init__(gameobject.Characteristics(**{'power': 1, 'mana_cost': '2(W/U)', 'color': ['W', 'U'], 'text': 'Flying\n{1}{(w/u)}, {Q}: Tap target creature. ({Q} is the untap symbol.)', 'toughness': 3, 'name': 'Silkbind Faerie', 'subtype': ['Faerie', 'Rogue']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[static_abilities.StaticAbilities.Flying]))
コード例 #23
0
 def __init__(self):
     super(c29973, self).__init__(gameobject.Characteristics(**{'text': "Whenever a player taps a land for mana, if it's not that player's turn, destroy that land.", 'mana_cost': '2R', 'name': 'Price of Glory', 'color': ['R']}, supertype=[], types=[cardtype.CardType.ENCHANTMENT], abilities=[]))
コード例 #24
0
 def __init__(self):
     super(c21320, self).__init__(gameobject.Characteristics(**{'power': 2, 'mana_cost': '3BB', 'color': ['B'], 'text': 'Flying\nBattlefield Percher can block only creatures with flying.\n{1}{B}: Battlefield Percher gets +1/+1 until end of turn.', 'toughness': 2, 'name': 'Battlefield Percher', 'subtype': ['Bird']}, supertype=[], types=[cardtype.CardType.CREATURE], abilities=[static_abilities.StaticAbilities.Flying]))
コード例 #25
0
 def __init__(self):
     super(c27255, self).__init__(gameobject.Characteristics(**{'text': 'Lightning Bolt deals 3 damage to target creature or player.', 'mana_cost': 'R', 'name': 'Lightning Bolt', 'color': ['R']}, supertype=[], types=[cardtype.CardType.INSTANT], abilities=[]))
コード例 #26
0
 def __init__(self):
     super(c212614, self).__init__(gameobject.Characteristics(**{'text': "(An ongoing scheme remains face up until it's abandoned.)\nEach opponent can't cast more than one spell each turn.\nAt the beginning of your upkeep, if no opponent cast a spell since your last turn ended, abandon this scheme.", 'mana_cost': '', 'name': 'I Bask in Your Silent Awe', 'color': []}, supertype=[], types=[cardtype.CardType.ONGOING, cardtype.CardType.SCHEME], abilities=[]))
コード例 #27
0
 def __init__(self):
     super(c5806, self).__init__(gameobject.Characteristics(**{'text': 'Cycling abilities you activate cost you up to {2} less to activate.', 'mana_cost': '2', 'name': 'Fluctuator', 'color': []}, supertype=[], types=[cardtype.CardType.ARTIFACT], abilities=[]))
コード例 #28
0
 def __init__(self):
     super(c221297, self).__init__(gameobject.Characteristics(**{'text': 'G', 'mana_cost': '', 'name': 'Forest', 'color': [], 'subtype': ['Forest']}, supertype=[cardtype.SuperType.BASIC], types=[cardtype.CardType.LAND], abilities=[]))
コード例 #29
0
 def __init__(self):
     super(c24615, self).__init__(gameobject.Characteristics(**{'text': 'Destroy target land. Its controller loses 2 life.', 'mana_cost': '3B', 'name': 'Despoil', 'color': ['B']}, supertype=[], types=[cardtype.CardType.SORCERY], abilities=[]))
コード例 #30
0
 def __init__(self):
     super(c983, self).__init__(gameobject.Characteristics(**{'text': 'R', 'mana_cost': '', 'name': 'Mountain', 'color': [], 'subtype': ['Mountain']}, supertype=[cardtype.SuperType.BASIC], types=[cardtype.CardType.LAND], abilities=[]))