Index: scripts/globals/effects/retaliation.lua =================================================================== --- scripts/globals/effects/retaliation.lua (revision 4045) +++ scripts/globals/effects/retaliation.lua (working copy) @@ -1,7 +1,7 @@ ----------------------------------- +-- Effect: Retaliation +-- Author: Davenge 10/12/2013 -- --- --- ----------------------------------- ----------------------------------- @@ -9,6 +9,7 @@ ----------------------------------- function onEffectGain(target,effect) + target:addMod(MOD_MOVE, -8); end; ----------------------------------- @@ -23,4 +24,5 @@ ----------------------------------- function onEffectLose(target,effect) -end; \ No newline at end of file + target:delMod(MOD_MOVE, -8); +end; Index: src/map/status_effect_container.cpp =================================================================== --- src/map/status_effect_container.cpp (revision 4045) +++ src/map/status_effect_container.cpp (working copy) @@ -942,13 +965,22 @@ string_t name; EFFECT effect = StatusEffect->GetStatusID(); (effect>=EFFECT_REQUIEM && effect <= EFFECT_NOCTURNE) || - (effect == EFFECT_DOUBLE_UP_CHANCE) || effect == EFFECT_BUST) + (effect == EFFECT_DOUBLE_UP_CHANCE) || effect == EFFECT_BUST || effect == EFFECT_RETALIATION ) { name.insert(0, "globals/effects/"); name.insert(name.size(), effects::EffectsParams[effect].Name); Index: src/map/utils/battleutils.cpp =================================================================== --- src/map/utils/battleutils.cpp (revision 4045) +++ src/map/utils/battleutils.cpp (working copy) @@ -552,8 +552,46 @@ { uint16 spikes = PDefender->getMod(MOD_SPIKES); Action->spikesMessage = 44; - if(spikes) + + if( PDefender->StatusEffectContainer->HasStatusEffect(EFFECT_RETALIATION) && + rand()%100 < PDefender->StatusEffectContainer->GetStatusEffect(EFFECT_RETALIATION)->GetPower() && + rand()%100 < battleutils::GetHitRate(PDefender, PAttacker) ) { + Action->reaction = REACTION_HIT; + Action->spikesEffect = SUBEFFECT_COUNTER; + if( battleutils::IsAbsorbByShadow(PAttacker) ) + Action->spikesMessage = 535; // retaliatesabsorbed by shadow + else + { + bool isCritical = ( rand()%100 < battleutils::GetCritHitRate(PDefender, PAttacker,false) ); + bool isHTH = PDefender->m_Weapons[SLOT_MAIN]->getDmgType() == DAMAGE_HTH; + float DamageRatio = battleutils::GetDamageRatio(PDefender, PAttacker,isCritical, 0); + Action->spikesMessage = 536; // retaltates attack + + if (!isHTH && PDefender->objtype == TYPE_MOB && PDefender->GetMJob() == JOB_MNK) + isHTH = true; + + int16 naturalh2hDMG = 0; + + if (isHTH) + naturalh2hDMG = (float)(PDefender->GetSkill(SKILL_H2H) * 0.11f)+3; + + uint16 retalDamage = (uint16)((PDefender->GetMainWeaponDmg() + naturalh2hDMG + battleutils::GetFSTR(PDefender, PAttacker,SLOT_MAIN)) * DamageRatio ); + if( PDefender->objtype == TYPE_PC ) + retalDamage = battleutils::CheckForDamageMultiplier(PDefender->m_Weapons[SLOT_MAIN],retalDamage,1); + Action->spikesParam = battleutils::TakePhysicalDamage(PDefender, PAttacker, retalDamage, false, SLOT_MAIN, 1, NULL, true ); + PAttacker->addHP(-Action->spikesParam); + + if(PDefender->objtype == TYPE_PC) + { + uint8 skilltype = (PDefender->m_Weapons[SLOT_MAIN] == NULL ? SKILL_H2H : PDefender->m_Weapons[SLOT_MAIN]->getSkillType()); + charutils::TrySkillUP((CCharEntity*)PDefender, (SKILLTYPE)skilltype, PAttacker->GetMLevel()); + } + + } + } + else if(spikes) + { Action->spikesParam = HandleStoneskin(PAttacker, CalculateSpikeDamage(PAttacker, PDefender, spikes, damage)); // handle level diff