class PoisonAffliction extends Affliction { private static DEFAULT_PERCENT = 5 ; private static MAX_STACK_NUM = 2 ; private static MAX_DAMAGE = 99999 ; percent : number ; constructor ( ) { super ( ENUM . AfflictionType . POISON ) ; this . percent = 0 ; this . finished = false ; } canAttack ( ) { return true ; } update ( card ) { let damage = Math . floor ( card . originalStats . hp * this . percent / 100 ) ; if ( damage > PoisonAffliction . MAX_DAMAGE ) { damage = PoisonAffliction . MAX_DAMAGE ; } BattleModel . getInstance ( ) . damageToTargetDirectly ( card , damage , "poison" ) ; } add ( option ) { let percent = option . percent ; if ( ! percent ) { percent = PoisonAffliction . DEFAULT_PERCENT ; } this . percent += percent ; let maxPercent = percent * PoisonAffliction . MAX_STACK_NUM ; if ( this . percent > maxPercent ) { this . percent = maxPercent ; } } }