NPC drops with Ice Barrage
Hey guys,
Something that I am struggling to do on a Ruse Base is with Ice Barrage or actually any Spells that hit inMulti
Right now, I've got an area where there are Chickens that are easy to 1 hit as they've only got 1 hp, but the thing is only the Chicken that I click on when casting the spell will drop loot such as bones.
Every other chicken that dies from the Area of Effect from a Barrage spell doesn't drop anything.
What I've done so far is just played around with CombatAncientSpell.java where in finishCast as it mentions hitting the NPCs in multi.
This is the code that I am working with, it's pretty much in every Ruse base.
Code:
Iterator<? extends Character> it = null;
if (cast.isPlayer() && castOn.isPlayer()) {
it = ((Player) cast).getLocalPlayers().iterator();
} else if (cast.isPlayer() && castOn.isNpc()) {
it = ((Player) cast).getLocalNpcs().iterator();
} else if (cast.isNpc() && castOn.isNpc()) {
it = World.getNpcs().iterator();
} else if (cast.isNpc() && castOn.isPlayer()) {
it = World.getPlayers().iterator();
}
for (Iterator<? extends Character> $it = it; $it.hasNext();) {
Character next = $it.next();
if (next == null) {
continue;
}
if(next.isNpc()) {
NPC n = (NPC)next;
if(!n.getDefinition().isAttackable() || n.isSummoningNpc()) {
continue;
}
} else {
Player p = (Player)next;
if(p.getLocation() != Location.WILDERNESS || !Location.inMulti(p)) {
continue;
}
}
if (next.getPosition().isWithinDistance(castOn.getPosition(),
spellRadius()) && !next.equals(cast) && !next.equals(castOn) && next.getConstitution() > 0 && next.getConstitution() > 0) {
cast.getCurrentlyCasting().endGraphic().ifPresent(next::performGraphic);
int calc = Misc.random(damage);
next.dealDamage(new Hit(calc, Hitmask.RED, CombatIcon.MAGIC));
next.getCombatBuilder().addDamage(cast, calc);
spellEffect(cast, next, calc);
}
}
Any pointers on what I should be doing, or looking for?
I've just concluded that the inMulti damage isn't considered the players which is why it doesn't drop anything.