Skip to content

Commit

Permalink
knockback elemental arrow bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
wkdgmr committed Oct 7, 2023
1 parent 0904160 commit 82f8315
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions Source/missiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,14 @@ bool MonsterMHit(int pnum, int monsterId, int mindam, int maxdam, int dist, Miss
} else {
if (monster.mode != MonsterMode::Petrified && missileData.isArrow() && HasAnyOf(player._pIFlags, ItemSpecialEffect::Knockback)) {
M_GetKnockback(monster);
missile.var6 = monster.position.old.x;
missile.var7 = monster.position.old.y;
} else if (monster.mode != MonsterMode::Petrified && player.InvBody[INVLOC_HAND_LEFT]._itype == ItemType::Bow
&& player.InvBody[INVLOC_HAND_LEFT]._iMagical == ITEM_QUALITY_UNIQUE) {
if (HasAllOf(player._pIFlags, ItemSpecialEffect::FastestAttack | ItemSpecialEffect::Empower) // Empowered Windforce
|| HasAllOf(player._pIFlags, ItemSpecialEffect::MultipleArrows | ItemSpecialEffect::Empower)) { // Empowered Gnat Sting
M_GetKnockback(monster);
missile.var6 = monster.position.old.x;
missile.var7 = monster.position.old.y;
if (HasAllOf(player._pIFlags, ItemSpecialEffect::FastestAttack | ItemSpecialEffect::Empower)) { // Empowered Windforce
AddMissile(monster.position.old, { 2, 0 }, Direction::South, MissileID::WeaponExplosion, TARGET_MONSTERS, player.getId(), 0, 0);
}
}
}
if (monster.type().type != MT_GOLEM)
Expand Down Expand Up @@ -3062,8 +3061,6 @@ Missile *AddMissile(Point src, Point dst, Direction midir, MissileID mitype,

void ProcessElementalArrow(Missile &missile)
{
Player &player = Players[missile._misource];
Point knockbackElement;
missile._mirange--;
if (missile._miAnimType == MissileGraphicID::ChargedBolt || missile._miAnimType == MissileGraphicID::MagmaBallExplosion) {
ChangeLight(missile._mlid, missile.position.tile, missile._miAnimFrame + 5);
Expand All @@ -3089,12 +3086,6 @@ void ProcessElementalArrow(Missile &missile)
maxd = GenerateRnd(10) + 1 + currlevel * 2;
}
MoveMissileAndCheckMissileCol(missile, DamageType::Physical, mind, maxd, true, false);
if (player.InvBody[INVLOC_HAND_LEFT]._itype == ItemType::Bow
&& player.InvBody[INVLOC_HAND_LEFT]._iMagical == ITEM_QUALITY_UNIQUE) {
if (HasAllOf(player._pIFlags, ItemSpecialEffect::FastestAttack | ItemSpecialEffect::Empower)) { // Empowered Windforce
Point knockbackElement = { missile.var6, missile.var7 };
}
}
if (missile._mirange == 0) {
missile._mimfnum = 0;
missile._mirange = missile._miAnimLen - 1;
Expand Down Expand Up @@ -3136,14 +3127,7 @@ void ProcessElementalArrow(Missile &missile)
break;
}
SetMissAnim(missile, eAnim);
if (player.InvBody[INVLOC_HAND_LEFT]._itype == ItemType::Bow
&& player.InvBody[INVLOC_HAND_LEFT]._iMagical == ITEM_QUALITY_UNIQUE) {
if (HasAllOf(player._pIFlags, ItemSpecialEffect::FastestAttack | ItemSpecialEffect::Empower)) { // Empowered Windforce
CheckMissileCol(missile, damageType, eMind, eMaxd, false, knockbackElement, true);
}
} else {
CheckMissileCol(missile, damageType, eMind, eMaxd, false, missile.position.tile, true);
}
CheckMissileCol(missile, damageType, eMind, eMaxd, false, missile.position.tile, true);
} else {
if (missile.position.tile != Point { missile.var1, missile.var2 }) {
missile.var1 = missile.position.tile.x;
Expand Down

0 comments on commit 82f8315

Please sign in to comment.