|
40 | 40 | #include "ai/states/weaponskill_state.h" |
41 | 41 | #include "attack.h" |
42 | 42 | #include "attackround.h" |
| 43 | +#include "blue_spell.h" |
43 | 44 | #include "items/item_weapon.h" |
44 | 45 | #include "job_points.h" |
45 | 46 | #include "lua/luautils.h" |
@@ -2306,6 +2307,7 @@ void CBattleEntity::OnCastFinished(CMagicState& state, action_t& action) |
2306 | 2307 |
|
2307 | 2308 | for (auto* PTarget : PAI->TargetFind->m_targets) |
2308 | 2309 | { |
| 2310 | + // Reset the spell's message to prevent any state carryover between targets |
2309 | 2311 | PSpell->setMessage(initialSpellMessage); |
2310 | 2312 |
|
2311 | 2313 | action_target_t& actionTarget = action.addTarget(PTarget->id); |
@@ -2361,7 +2363,7 @@ void CBattleEntity::OnCastFinished(CMagicState& state, action_t& action) |
2361 | 2363 |
|
2362 | 2364 | actionResult.param = damage; |
2363 | 2365 |
|
2364 | | - // spell failed to apply |
| 2366 | + // Handle spell failed to apply |
2365 | 2367 | if (!PSpell->tookEffect()) |
2366 | 2368 | { |
2367 | 2369 | actionResult.resolution = ActionResolution::Miss; |
@@ -2405,6 +2407,32 @@ void CBattleEntity::OnCastFinished(CMagicState& state, action_t& action) |
2405 | 2407 | msg != MsgBasic::ShadowAbsorb) // If message isn't the shadow loss message, because I had to move this outside of the above check for it. |
2406 | 2408 | { |
2407 | 2409 | luautils::OnMagicHit(this, PTarget, PSpell); |
| 2410 | + |
| 2411 | + // Process Blu Spell based Actions |
| 2412 | + if (PSpell->getSpellGroup() == SPELLGROUP_BLUE && PSpell->getMessage() != MsgBasic::MagicFail) |
| 2413 | + { |
| 2414 | + if (auto* PBlueSpell = dynamic_cast<CBlueSpell*>(PSpell)) |
| 2415 | + { |
| 2416 | + // Physical Blue Spells trigger HitDistortion - using the existence of a Primary Skillchain element as a physical indicator |
| 2417 | + if (PBlueSpell->getPrimarySkillchain() != 0) |
| 2418 | + { |
| 2419 | + // This will set the Hit Distortion field |
| 2420 | + actionResult.recordDamage(attack_outcome_t{ |
| 2421 | + .atkType = ATTACK_TYPE::PHYSICAL, |
| 2422 | + .damage = damage, |
| 2423 | + .target = PTarget, |
| 2424 | + .isCritical = false, // ToDo: Get Critical status from spell processing |
| 2425 | + }); |
| 2426 | + } |
| 2427 | + |
| 2428 | + // Some Physical Blue Spells present with a knockback effect - using knockback on linked Mob Skill to determine which |
| 2429 | + CMobSkill* mobSkillForBlueSpell = battleutils::GetMobSkill(PBlueSpell->getMonsterSkillId()); |
| 2430 | + if (mobSkillForBlueSpell) |
| 2431 | + { |
| 2432 | + actionResult.knockback = mobSkillForBlueSpell->getKnockback(); |
| 2433 | + } |
| 2434 | + } |
| 2435 | + } |
2408 | 2436 | } |
2409 | 2437 |
|
2410 | 2438 | // The entity under consideration for RoE objective credit |
|
0 commit comments