forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -27,77 +27,76 @@ import java.util.HashSet;
|
||||
|
||||
public class ChantJob extends AbstractEffectJob {
|
||||
|
||||
private final AbstractEffectJob aej;
|
||||
private int iteration = 0;
|
||||
private final AbstractEffectJob aej;
|
||||
private int iteration = 0;
|
||||
|
||||
public ChantJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, AbstractEffectJob aej) {
|
||||
super(source, target, stackType, trains, action, power, eb);
|
||||
this.aej = aej;
|
||||
}
|
||||
public ChantJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, AbstractEffectJob aej) {
|
||||
super(source, target, stackType, trains, action, power, eb);
|
||||
this.aej = aej;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
if (this.aej == null || this.source == null || this.target == null || this.action == null || this.power == null || this.source == null || this.eb == null)
|
||||
return;
|
||||
PlayerBonuses bonuses = null;
|
||||
|
||||
//if player isnt in game, do not run chant.
|
||||
if (this.source.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
if (SessionManager.getPlayerCharacterByID(this.source.getObjectUUID()) == null)
|
||||
return;
|
||||
}
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
bonuses = ((AbstractCharacter)source).getBonuses();
|
||||
if (!this.source.isAlive()) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
((AbstractCharacter)source).cancelLastChant();
|
||||
} else if (bonuses != null && bonuses.getBool(ModType.Silenced, SourceType.None)) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
((AbstractCharacter)source).cancelLastChant();
|
||||
}
|
||||
else if (AbstractWorldObject.IsAbstractCharacter(source) && ((AbstractCharacter)source).isSit()){
|
||||
return;
|
||||
}else if (this.iteration < this.power.getChantIterations() && AbstractWorldObject.IsAbstractCharacter(source)) {
|
||||
this.skipSendEffect = true;
|
||||
this.iteration++;
|
||||
@Override
|
||||
protected void doJob() {
|
||||
if (this.aej == null || this.source == null || this.target == null || this.action == null || this.power == null || this.source == null || this.eb == null)
|
||||
return;
|
||||
PlayerBonuses bonuses = null;
|
||||
|
||||
// *** Refactor holy wtf batman
|
||||
//if player isnt in game, do not run chant.
|
||||
if (this.source.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
if (SessionManager.getPlayerCharacterByID(this.source.getObjectUUID()) == null)
|
||||
return;
|
||||
}
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
bonuses = ((AbstractCharacter) source).getBonuses();
|
||||
if (!this.source.isAlive()) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
((AbstractCharacter) source).cancelLastChant();
|
||||
} else if (bonuses != null && bonuses.getBool(ModType.Silenced, SourceType.None)) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
((AbstractCharacter) source).cancelLastChant();
|
||||
} else if (AbstractWorldObject.IsAbstractCharacter(source) && ((AbstractCharacter) source).isSit()) {
|
||||
return;
|
||||
} else if (this.iteration < this.power.getChantIterations() && AbstractWorldObject.IsAbstractCharacter(source)) {
|
||||
this.skipSendEffect = true;
|
||||
this.iteration++;
|
||||
|
||||
String stackType = action.getStackType();
|
||||
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(action.getUUID()) : stackType;
|
||||
// *** Refactor holy wtf batman
|
||||
|
||||
HashSet<AbstractWorldObject> awolist = null;
|
||||
if (this.source instanceof PlayerCharacter)
|
||||
awolist = PowersManager.getAllTargets(this.source, this.source.getLoc(), (PlayerCharacter)this.source, this.power);
|
||||
else
|
||||
awolist = new HashSet<>();
|
||||
for (AbstractWorldObject awo : awolist) {
|
||||
String stackType = action.getStackType();
|
||||
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(action.getUUID()) : stackType;
|
||||
|
||||
if (awo == null)
|
||||
continue;
|
||||
HashSet<AbstractWorldObject> awolist = null;
|
||||
if (this.source instanceof PlayerCharacter)
|
||||
awolist = PowersManager.getAllTargets(this.source, this.source.getLoc(), (PlayerCharacter) this.source, this.power);
|
||||
else
|
||||
awolist = new HashSet<>();
|
||||
for (AbstractWorldObject awo : awolist) {
|
||||
|
||||
PowersManager.finishApplyPowerA((AbstractCharacter) this.source, awo, awo.getLoc(), this.power, this.trains, true);
|
||||
if (awo == null)
|
||||
continue;
|
||||
|
||||
}
|
||||
PowersManager.finishApplyPowerA((AbstractCharacter) this.source, awo, awo.getLoc(), this.power, this.trains, true);
|
||||
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
//handle invul
|
||||
if(power.getUUID() != 334)
|
||||
((AbstractCharacter)this.source).setLastChant((int)(this.power.getChantDuration()) * 1000, this);
|
||||
else
|
||||
((AbstractCharacter)this.source).setLastChant((int)(this.power.getChantDuration()) * 1000, this);
|
||||
} else {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source)) {
|
||||
((AbstractCharacter)source).cancelLastChant();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
//handle invul
|
||||
if (power.getUUID() != 334)
|
||||
((AbstractCharacter) this.source).setLastChant((int) (this.power.getChantDuration()) * 1000, this);
|
||||
else
|
||||
((AbstractCharacter) this.source).setLastChant((int) (this.power.getChantDuration()) * 1000, this);
|
||||
} else {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source)) {
|
||||
((AbstractCharacter) source).cancelLastChant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user