Permalink
Browse files

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.
  • Loading branch information...
1 parent 5338d44 commit 3e8fa1bd1bda519d26e090db18fc7f2f15c2f801 @encukou committed Feb 11, 2012
Showing with 9 additions and 3 deletions.
  1. +1 −1 pokedex/data/csv/move_meta.csv
  2. +8 −2 pokedex/db/tables.py
@@ -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
View
@@ -33,6 +33,7 @@
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
@@ -889,8 +890,8 @@ class MoveMeta(TableBase):
info=dict(description="Minimum number of turns the user is forced to use the move"))
max_turns = Column(Integer, nullable=True, index=True,
info=dict(description="Maximum number of turns the user is forced to use the move"))
- recoil = Column(Integer, nullable=False, index=True,
- info=dict(description="Recoil damage, in percent of damage done"))
+ drain = Column(Integer, nullable=False, index=True,
+ info=dict(description="HP drain (if positive) or Recoil damage (if negative), in percent of damage done"))
healing = Column(Integer, nullable=False, index=True,
info=dict(description="Healing, in percent of user's max HP"))
crit_rate = Column(Integer, nullable=False, index=True,
@@ -902,6 +903,11 @@ class MoveMeta(TableBase):
stat_chance = Column(Integer, nullable=False, index=True,
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):
u"""Common status ailments moves can inflict on a single Pokémon, including
major ailments like paralysis and minor ailments like trapping.

0 comments on commit 3e8fa1b

Please sign in to comment.