Browse Source

hate value for chants to affect mobs in range

mobile-class-refactor
FatBoy-DOTC 1 year ago
parent
commit
a50a2430ba
  1. 25
      src/engine/powers/poweractions/ApplyEffectPowerAction.java

25
src/engine/powers/poweractions/ApplyEffectPowerAction.java

@ -11,6 +11,7 @@ package engine.powers.poweractions;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ModType; import engine.Enum.ModType;
import engine.Enum.SourceType; import engine.Enum.SourceType;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.jobs.ChantJob; import engine.jobs.ChantJob;
import engine.jobs.DeferredPowerJob; import engine.jobs.DeferredPowerJob;
@ -22,6 +23,7 @@ import engine.objects.*;
import engine.powers.ActionsBase; import engine.powers.ActionsBase;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -117,21 +119,12 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
awo.addEffect(stackType, duration, eff, effect, trains); awo.addEffect(stackType, duration, eff, effect, trains);
} else } else
awo.applyAllBonuses(); awo.applyAllBonuses();
// //TODO if chant, start cycle
// if (pb.isChant() && source.equals(awo)) {
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
// eff.setChant(true);
// }
if (this.effectID.equals("TAUNT")) { if (this.effectID.equals("TAUNT")) {
if (awo != null && awo.getObjectType() == GameObjectType.Mob) { if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
//((Mob) awo).setCombatTarget(source); LOL DUMB
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo); ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg); DispatchMessage.sendToAllInRange(source, msg);
//((Mob)awo).refresh(); why the fuck? causes a blink effect and players to lose target of the mob
} }
} }
if (awo != null && awo.getObjectType() == GameObjectType.Mob) { if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
@ -141,8 +134,22 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
} }
this.effect.startEffect(source, awo, trains, eff); this.effect.startEffect(source, awo, trains, eff);
} }
//apply effects to mobs within range for chants
if(pb.isChant){
for(AbstractGameObject ago : WorldGrid.getObjectsInRangePartial(awo.loc,pb.range, MBServerStatics.MASK_MOB)){
Mob mob = (Mob)ago;
if(mob.playerAgroMap.containsKey(source.getObjectUUID()))
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
} }
}else {
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
Mob mob = (Mob) awo;
if (mob.playerAgroMap.containsKey(source.getObjectUUID()))
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
}
}
}
protected void _applyEffectForItem(Item item, int trains) { protected void _applyEffectForItem(Item item, int trains) {
if (item == null || this.effect == null) if (item == null || this.effect == null)

Loading…
Cancel
Save