Fix drain/recoil name in MoveMeta

The column was named recoil, but positive values meant
drain.
Rename the column, and introduce a hybrid property for
recoil.
This commit is contained in:
Petr Viktorin 2012-02-11 16:04:25 +01:00 committed by Andrew Ekstedt
parent 0094e9584c
commit df945eb601
2 changed files with 9 additions and 3 deletions

View file

@ -1,4 +1,4 @@
move_id,meta_category_id,meta_ailment_id,min_hits,max_hits,min_turns,max_turns,recoil,healing,crit_rate,ailment_chance,flinch_chance,stat_chance
move_id,meta_category_id,meta_ailment_id,min_hits,max_hits,min_turns,max_turns,drain,healing,crit_rate,ailment_chance,flinch_chance,stat_chance
1,0,0,,,,,0,0,0,0,0,0
2,0,0,,,,,0,0,1,0,0,0
3,0,0,2,5,,,0,0,0,0,0,0

1 move_id meta_category_id meta_ailment_id min_hits max_hits min_turns max_turns recoil drain healing crit_rate ailment_chance flinch_chance stat_chance
2 1 0 0 0 0 0 0 0 0
3 2 0 0 0 0 1 0 0 0
4 3 0 0 2 5 0 0 0 0 0 0

View file

@ -32,6 +32,7 @@ from functools import partial
from sqlalchemy import Column, ForeignKey, MetaData, PrimaryKeyConstraint, Table, UniqueConstraint
from sqlalchemy.ext.declarative import declarative_base, DeclarativeMeta
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import backref, relationship
from sqlalchemy.orm.session import Session
from sqlalchemy.orm.interfaces import AttributeExtension
@ -1351,8 +1352,8 @@ class MoveMeta(TableBase):
doc=u"Minimum number of turns the user is forced to use the move")
max_turns = Column(Integer, nullable=True, index=True,
doc=u"Maximum number of turns the user is forced to use the move")
recoil = Column(Integer, nullable=False, index=True,
doc=u"Recoil damage, in percent of damage done")
drain = Column(Integer, nullable=False, index=True,
doc=u"HP drain (if positive) or Recoil damage (if negative), in percent of damage done")
healing = Column(Integer, nullable=False, index=True,
doc=u"Healing, in percent of user's max HP")
crit_rate = Column(Integer, nullable=False, index=True,
@ -1364,6 +1365,11 @@ class MoveMeta(TableBase):
stat_chance = Column(Integer, nullable=False, index=True,
doc=u"Chance to cause a stat change, in percent")
@hybrid_property
def recoil(self):
u"""Recoil damage or HP drain; the opposite of `drain`. """
return -self.drain
class MoveMetaAilment(TableBase):
u"""Common status ailments moves can inflict on a single Pokémon, including
major ailments like paralysis and minor ailments like trapping.