Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /************************************************************************
- * *
- * Calculate Power of Damage Spell *
- * *
- ************************************************************************/
- uint16 TakeMagicDamage(CBattleEntity* PAttacker, CBattleEntity* PDefender)
- {
- DSP_DEBUG_BREAK_IF(PAttacker->PBattleAI->GetCurrentSpell() == NULL);
- DSP_DEBUG_BREAK_IF(PAttacker->PBattleAI->GetCurrentAction() != ACTION_MAGIC_FINISH);
- CSpell* PSpell = PAttacker->PBattleAI->GetCurrentSpell();
- int32 INT = (PAttacker->stats.INT + PAttacker->getMod(MOD_INT)) - (PDefender->stats.INT + PDefender->getMod(MOD_INT));
- int32 MND = (PAttacker->stats.MND + PAttacker->getMod(MOD_MND)) - (PDefender->stats.MND + PDefender->getMod(MOD_MND));
- int32 base = PSpell->getBase();
- float M = PSpell->getMultiplier();
- int32 magias = PSpell->getID();
- if (magias >= 144 || magias <= 215)
- {
- int32 damage = INT < 0 ? base + INT : base + (INT * M);
- damage = damage * (100 - (10 * PAttacker->m_ActionList.size() / 2)) / 100;
- damage = damage * (1000 + PDefender->getMod(MOD_FIRERES + PSpell->getElement())) / 1000;
- PDefender->addHP(-damage);
- PDefender->m_OwnerID = PAttacker->PMaster != NULL ? PAttacker->PMaster->id : PAttacker->id;
- switch (PDefender->objtype)
- {
- case TYPE_PC:
- {
- PDefender->StatusEffectContainer->DelStatusEffectsByFlag(EFFECTFLAG_DAMAGE);
- if(PDefender->animation == ANIMATION_SIT)
- {
- PDefender->animation = ANIMATION_NONE;
- ((CCharEntity*)PDefender)->pushPacket(new CCharUpdatePacket((CCharEntity*)PDefender));
- }
- charutils::UpdateHealth((CCharEntity*)PDefender);
- }
- break;
- case TYPE_MOB:
- {
- ((CMobEntity*)PDefender)->PEnmityContainer->UpdateEnmityFromDamage(PAttacker, damage);
- }
- break;
- }
- return damage;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- if (magias == 21 || magias == 22 || magias >= 19 || magias <= 22 )
- {
- int32 damageMND = MND < 0 ? base + MND : base + (MND * M);
- damageMND = damageMND * (100 - (10 * PAttacker->m_ActionList.size() / 2)) / 100;
- damageMND = damageMND * (1000 + PDefender->getMod(MOD_LIGHTRES + PSpell->getElement())) / 1000;
- PDefender->addHP(-damageMND);
- PDefender->m_OwnerID = PAttacker->PMaster != NULL ? PAttacker->PMaster->id : PAttacker->id;
- switch (PDefender->objtype)
- {
- case TYPE_PC:
- {
- PDefender->StatusEffectContainer->DelStatusEffectsByFlag(EFFECTFLAG_DAMAGE);
- if(PDefender->animation == ANIMATION_SIT)
- {
- PDefender->animation = ANIMATION_NONE;
- ((CCharEntity*)PDefender)->pushPacket(new CCharUpdatePacket((CCharEntity*)PDefender));
- }
- charutils::UpdateHealth((CCharEntity*)PDefender);
- }
- break;
- case TYPE_MOB:
- {
- ((CMobEntity*)PDefender)->PEnmityContainer->UpdateEnmityFromDamage(PAttacker, damage);
- }
- break;
- }
- return damageMND;
- }
- }
Add Comment
Please, Sign In to add comment