Implement an ability changelog; add a few changes. #78
authorZhorken <zhorken@gmail.com>
Mon, 6 Dec 2010 22:45:43 +0000 (17:45 -0500)
committerZhorken <zhorken@gmail.com>
Mon, 6 Dec 2010 22:55:09 +0000 (17:55 -0500)
pokedex/data/csv/ability_changelog.csv [new file with mode: 0644]
pokedex/db/tables.py

diff --git a/pokedex/data/csv/ability_changelog.csv b/pokedex/data/csv/ability_changelog.csv
new file mode 100644 (file)
index 0000000..345a0d5
--- /dev/null
@@ -0,0 +1,12 @@
+ability_id,changed_in_version_group_id,effect
+1,11,Has no effect in battle.
+16,11,Triggers on every hit of multiple-hit moves.
+24,8,Inflicts only 1/16 of the attacker's maximum [HP]{mechanic} in damage.
+28,11,Passes back toxic [poison]{mechanic} as regular poison.
+31,8,"Does not absorb non-damaging [Electric]{type} moves, i.e. [Thunder Wave]{move}."
+31,11,Grants no [Electric]{type} immunity or [Special Attack]{mechanic} boosts.
+53,11,Has no effect in battle.
+98,11,"Paralysis cannot prevent the Pokémon from moving, though the [Speed]{mechanic} cut is unaffected."
+102,11,[Rest]{move} works as normal during [strong sunlight]{mechanic}.
+103,11,[Fling]{move} can be used as normal.
+114,11,Grants no [Water]{type} immunity or [Special Attack]{mechanic} boosts.
index 1db5898..958cfb7 100644 (file)
@@ -53,6 +53,16 @@ class Ability(TableBase):
     short_effect = Column(markdown.MarkdownColumn(255), nullable=False,
         info=dict(description="Short summary of this ability's effect", format='markdown'))
 
+class AbilityChangelog(TableBase):
+    """History of changes to abilities across main game versions."""
+    __tablename__ = 'ability_changelog'
+    ability_id = Column(Integer, ForeignKey('abilities.id'), primary_key=True, nullable=False,
+        info=dict(description="The ID of the ability that changed"))
+    changed_in_version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False,
+        info=dict(description="The ID of the version group in which the ability changed"))
+    effect = Column(markdown.MarkdownColumn(255), nullable=False,
+        info=dict(description="A description of the old behavior", format='markdown'))
+
 class AbilityFlavorText(TableBase):
     u"""In-game flavor text of an ability
     """
@@ -1261,18 +1271,22 @@ class VersionGroupRegion(TableBase):
         info=dict(description=u"ID of the region"))
 
 class Version(TableBase):
-    u"""A version of a mainline pokémon game
+    u"""An individual main-series Pokémon game
     """
     __tablename__ = 'versions'
     id = Column(Integer, primary_key=True, nullable=False,
-        info=dict(description=u"A numeric ID"))
+        info=dict(description=u"A unique ID for this version"))
     version_group_id = Column(Integer, ForeignKey('version_groups.id'), nullable=False,
-        info=dict(description=u"ID of the version group this game belongs to"))
+        info=dict(description=u"The ID of the version group this game belongs to"))
     name = Column(Unicode(32), nullable=False,
         info=dict(description=u'The English name of the game, without the "Pokémon" prefix', official=True, format='plaintext'))
 
 
 ### Relations down here, to avoid ordering problems
+Ability.changelog = relation(AbilityChangelog,
+    order_by=AbilityChangelog.changed_in_version_group_id.desc(),
+    backref='ability',
+)
 Ability.flavor_text = relation(AbilityFlavorText, order_by=AbilityFlavorText.version_group_id, backref='ability')
 Ability.foreign_names = relation(AbilityName, backref='ability')
 Ability.generation = relation(Generation, backref='abilities')
@@ -1280,6 +1294,8 @@ Ability.pokemon = relation(Pokemon,
     secondary=PokemonAbility.__table__,
 )
 
+AbilityChangelog.changed_in = relation(VersionGroup, backref='ability_changelog')
+
 AbilityFlavorText.version_group = relation(VersionGroup)
 
 AbilityName.language = relation(Language)