class AbsorbSkillLogic extends SkillLogic { execute ( data ) { let skill = data . skill ; let executor = data . executor ; skill . getReady ( executor ) ; let target ; while ( target = skill . getTarget ( executor ) ) { this . absorbTarget ( executor , target , skill ) ; } } absorbTarget ( executor , target , skill ) { let statusToBuff = AbsorbSkillLogic . getComponentStatusFromBuffStatusType ( skill . skillFuncArg2 ) ; let debuffMulti = skill . skillFuncArg3 ; if ( executor . isDead || ! executor . canUseSkill ( ) ) { return ; } if ( Math . random ( ) > skill . skillFuncArg6 ) { return ; } for ( let j = 0 ; j < statusToBuff . length ; j ++ ) { let statusType = statusToBuff [ j ] ; let calcType = skill . skillFuncArg4 ; let isNewLogic = false ; if ( calcType !== ENUM . SkillCalcType . DEBUFF ) { assert ( calcType === ENUM . SkillCalcType . WIS , "Non WIS-based debuff unimplemented!" ) ; var debuffAmount = Math . floor ( executor . getWIS ( ) * debuffMulti ) ; } else { debuffAmount = skill . skillFuncArg3 ; } let lowStatLimit = target . getOriginalStat ( ENUM . StatusType [ statusType ] ) * Card . NEW_DEBUFF_LOW_LIMIT_FACTOR ; let currentStat = target . getStat ( ENUM . StatusType [ statusType ] ) ; let maxDebuffLimit = lowStatLimit > currentStat ? 0 : currentStat - lowStatLimit ; if ( debuffAmount > maxDebuffLimit ) { debuffAmount = maxDebuffLimit ; } target . changeStatus ( statusType , - debuffAmount , isNewLogic ) ; this . logger . addMinorEvent ( { executorId : executor . id , targetId : target . id , type : ENUM . MinorEventType . STATUS , status : { type : statusType , isNewLogic : isNewLogic } , description : target . name + "'s " + ENUM . StatusType [ statusType ] + " decreased by " + Math . abs ( debuffAmount ) , amount : - debuffAmount , skillId : skill . id } ) ; let buffAmount = Math . floor ( Math . abs ( debuffAmount ) * skill . skillFuncArg5 ) ; executor . changeStatus ( statusType , buffAmount , false ) ; this . logger . addMinorEvent ( { executorId : executor . id , targetId : executor . id , type : ENUM . MinorEventType . STATUS , status : { type : statusType , isAllUp : skill . skillFuncArg2 === ENUM . StatusType . ALL_STATUS } , description : executor . name + "'s " + ENUM . StatusType [ statusType ] + " increased by " + buffAmount , amount : buffAmount , skillId : skill . id } ) ; } } static getComponentStatusFromBuffStatusType ( type ) { switch ( type ) { case ENUM . BuffStatusType . ATK : return [ ENUM . StatusType . ATK ] ; case ENUM . BuffStatusType . DEF : return [ ENUM . StatusType . DEF ] ; case ENUM . BuffStatusType . WIS : return [ ENUM . StatusType . WIS ] ; case ENUM . BuffStatusType . AGI : return [ ENUM . StatusType . AGI ] ; case ENUM . BuffStatusType . ATK_DEF : return [ ENUM . StatusType . ATK , ENUM . StatusType . DEF ] ; case ENUM . BuffStatusType . ATK_WIS : return [ ENUM . StatusType . ATK , ENUM . StatusType . WIS ] ; case ENUM . BuffStatusType . ATK_AGI : return [ ENUM . StatusType . ATK , ENUM . StatusType . AGI ] ; case ENUM . BuffStatusType . DEF_WIS : return [ ENUM . StatusType . DEF , ENUM . StatusType . WIS ] ; case ENUM . BuffStatusType . DEF_AGI : return [ ENUM . StatusType . DEF , ENUM . StatusType . AGI ] ; case ENUM . BuffStatusType . WIS_AGI : return [ ENUM . StatusType . WIS , ENUM . StatusType . AGI ] ; case ENUM . BuffStatusType . ATK_DEF_WIS : return [ ENUM . StatusType . ATK , ENUM . StatusType . DEF , ENUM . StatusType . WIS ] ; case ENUM . BuffStatusType . ATK_DEF_AGI : return [ ENUM . StatusType . ATK , ENUM . StatusType . DEF , ENUM . StatusType . AGI ] ; case ENUM . BuffStatusType . DEF_WIS_AGI : return [ ENUM . StatusType . DEF , ENUM . StatusType . WIS , ENUM . StatusType . AGI ] ; case ENUM . BuffStatusType . ALL_STATUS : return [ ENUM . StatusType . ATK , ENUM . StatusType . DEF , ENUM . StatusType . WIS , ENUM . StatusType . AGI ] ; default : return [ ENUM . StatusType . WIS ] ; } } }