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
parent 5338d44272
commit 3e8fa1bd1b
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 1,0,0,,,,,0,0,0,0,0,0
2,0,0,,,,,0,0,1,0,0,0 2,0,0,,,,,0,0,1,0,0,0
3,0,0,2,5,,,0,0,0,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

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