Skip to content

Commit

Permalink
Update card.py
Browse files Browse the repository at this point in the history
  • Loading branch information
poslogithub committed Mar 11, 2022
1 parent 89e58c1 commit 221fef1
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions source/mtga/models/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,39 @@ def to_serializable(self):
"color_identity": self.color_identity,
"card_type": self.card_type,
"sub_types": self.sub_types,
"super_types": self.super_types,
"rarity": self.rarity,
"set_number": self.set_number,
"mtga_id": self.mtga_id
}

@property
def is_creature_card(self):
if "クリーチャー" in self.card_types or "Creature" in self.card_types:
return True
else:
return False

@property
def is_land_card(self):
if "土地" in self.card_types or "Land" in self.card_types:
return True
else:
return False

@property
def is_noncreature_spell_card(self):
if not self.is_creature_card and not self.is_land_card:
return True
else:
return False

@property
def is_basic(self):
if "基本" in self.super_types or "Basic" in self.super_types:
return True
else:
return False

@classmethod
def from_dict(cls, obj):
Expand All @@ -109,8 +138,8 @@ def __str__(self):

class GameCard(Card):

def __init__(self, name, pretty_name, cost, color_identity, card_type, sub_types, set_id, rarity, set_number, mtga_id, owner_seat_id, game_id=-1):
super().__init__(name, pretty_name, cost, color_identity, card_type, sub_types, set_id, rarity, set_number, mtga_id)
def __init__(self, name, pretty_name, cost, color_identity, card_type, sub_types, super_types, set_id, rarity, set_number, mtga_id, owner_seat_id, game_id=-1):
super().__init__(name, pretty_name, cost, color_identity, card_type, sub_types, super_types, set_id, rarity, set_number, mtga_id)
self.game_id = game_id
self.previous_iids = []
self.owner_seat_id = owner_seat_id
Expand All @@ -135,6 +164,7 @@ def transform_to(self, card_id):
self.cost = new_card.cost
self.card_type = new_card.card_type
self.sub_types = new_card.sub_types
self.super_types = new_card.super_types
self.set = new_card.set
self.set_number = new_card.set_number
self.mtga_id = new_card.mtga_id

0 comments on commit 221fef1

Please sign in to comment.