Skip to content

Commit

Permalink
Elemental and BoneSpirit crawl
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 committed Mar 7, 2024
1 parent 89f1a48 commit fc1efbf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Source/missiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4041,13 +4041,19 @@ void ProcessElemental(Missile &missile)
if (missile.var3 == 1) {
missile.var3 = 2;
missile._mirange = 255;

auto *player = missile.sourcePlayer();
auto *nextMonster = FindClosest(missilePosition, 19);
if (nextMonster != nullptr) {

// Should we also be checking isPossibleToHit() and isImmune()?
if (nextMonster != nullptr && !nextMonster->belongsToPlayer(*player) && !(nextMonster->isPlayerMinion() && sgGameInitInfo.bFriendlyFire == 0 && player->friendlyMode)) {
Direction sd = GetDirection(missilePosition, nextMonster->position.tile);

SetMissDir(missile, sd);
UpdateMissileVelocity(missile, nextMonster->position.tile, 16);
} else {
Direction sd = Players[missile._misource]._pdir;

SetMissDir(missile, sd);
UpdateMissileVelocity(missile, missilePosition + sd, 16);
}
Expand Down Expand Up @@ -4086,8 +4092,10 @@ void ProcessBoneSpirit(Missile &missile)
if (missile.var3 == 1) {
missile.var3 = 2;
missile._mirange = 255;
auto *player = missile.sourcePlayer();
auto *monster = FindClosest(c, 19);
if (monster != nullptr) {
// Should we also be checking isPossibleToHit() and isImmune()?
if (monster != nullptr && !monster->belongsToPlayer(*player) && !(monster->isPlayerMinion() && sgGameInitInfo.bFriendlyFire == 0 && player->friendlyMode)) {
missile._midam = monster->hitPoints >> 7;
SetMissDir(missile, GetDirection(c, monster->position.tile));
UpdateMissileVelocity(missile, monster->position.tile, 16);
Expand Down

0 comments on commit fc1efbf

Please sign in to comment.