This effect can be passed with :move:`Baton Pass`."
183,0,Lowers the user's Attack and Defense by one level after inflicting damage.,"Inflicts :mechanic:`regular damage`, then :mechanic:`lowers` the user's mechanic:`Attack` and mechanic:`Defense` by one level."
-184,4,Reflects back any effects the target tries to use on the user this turn.,"Until the user leaves the mechanic:`field`, any non-damaging move targeting the user that inflicts mechanic:`major status effect`\ s, mechanic:`stat change`\ s, or mechanic:`trap`\ ping effects will be reflected at its user.
+184,4,Reflects back the first effect move used on the user this turn.,"The first non-damaging move targeting the user this turn that inflicts :mechanic:`major status effect`\ s, :mechanic:`stat change`\ s, or :mechanic:`trap`\ ping effects will be reflected at its user.
:move:`Defog`, :move:`Memento`, and :move:`Teeter Dance` are not reflected.
import docutils.utils
from docutils.writers.html4css1 import Writer as HTMLWriter
+import sqlalchemy.types
+
### Subclasses of bits of docutils, to munge it into doing what I want
class HTMLFragmentWriter(HTMLWriter):
"""Translates reST to HTML, but only as a fragment. Enclosing <body>,
class MoveEffectProperty(object):
"""Property that wraps a move effect. Used like this:
- MoveClass.effect = MoveEffectProperty()
+ MoveClass.effect = MoveEffectProperty('effect')
some_move.effect # returns an RstString
some_move.effect.as_html # returns a chunk of HTML
return RstString(getattr(move.move_effect, self.effect_column),
document_properties=dict(
_pokedex_handle_data=data_role_func))
+
+class RstTextColumn(sqlalchemy.types.TypeDecorator):
+ """Generic column type for reST text.
+
+ Do NOT use this for move effects! They need to know what move they belong
+ to so they can fill in, e.g., effect chances.
+ """
+ impl = sqlalchemy.types.Unicode
+
+ def process_bind_param(self, value, dialect):
+ return unicode(value)
+
+ def process_result_value(self, value, dialect):
+ return RstString(value)
short_effect = Column(Unicode(256), nullable=False)
effect = Column(Unicode(5120), nullable=False)
+class MoveFlag(TableBase):
+ __tablename__ = 'move_flags'
+ move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False)
+ move_flag_type_id = Column(Integer, ForeignKey('move_flag_types.id'), primary_key=True, nullable=False, autoincrement=False)
+
+class MoveFlagType(TableBase):
+ __tablename__ = 'move_flag_types'
+ id = Column(Integer, primary_key=True, nullable=False)
+ name = Column(Unicode(32), nullable=False)
+ description = Column(rst.RstTextColumn(128), nullable=False)
+
class MoveName(TableBase):
__tablename__ = 'move_names'
move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False)
Machine.generation = relation(Generation)
Move.damage_class = relation(MoveDamageClass, backref='moves')
+Move.flags = association_proxy('move_flags', 'flag')
Move.foreign_names = relation(MoveName, backref='pokemon')
Move.generation = relation(Generation, backref='moves')
Move.machines = relation(Machine, backref='move')
Move.move_effect = relation(MoveEffect, backref='moves')
+Move.move_flags = relation(MoveFlag, backref='move')
Move.target = relation(MoveTarget, backref='moves')
Move.type = relation(Type, backref='moves')
Move.priority = association_proxy('move_effect', 'priority')
Move.short_effect = rst.MoveEffectProperty('short_effect')
+MoveFlag.flag = relation(MoveFlagType)
+
MoveName.language = relation(Language)
Pokemon.abilities = relation(Ability, secondary=PokemonAbility.__table__,