forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -22,71 +22,71 @@ import engine.powers.poweractions.DamageOverTimePowerAction;
|
||||
|
||||
public class DamageOverTimeJob extends AbstractEffectJob {
|
||||
|
||||
private final DamageOverTimePowerAction dot;
|
||||
private int iteration = 0;
|
||||
private int liveCounter = 0;
|
||||
private final DamageOverTimePowerAction dot;
|
||||
private int iteration = 0;
|
||||
private int liveCounter = 0;
|
||||
|
||||
public DamageOverTimeJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, DamageOverTimePowerAction dot) {
|
||||
super(source, target, stackType, trains, action, power, eb);
|
||||
public DamageOverTimeJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, DamageOverTimePowerAction dot) {
|
||||
super(source, target, stackType, trains, action, power, eb);
|
||||
|
||||
this.dot = dot;
|
||||
if (this.target != null && AbstractWorldObject.IsAbstractCharacter(target))
|
||||
this.liveCounter = ((AbstractCharacter)target).getLiveCounter();
|
||||
|
||||
this.iteration = action.getDurationInSeconds(trains) / this.dot.getNumIterations();
|
||||
}
|
||||
this.dot = dot;
|
||||
if (this.target != null && AbstractWorldObject.IsAbstractCharacter(target))
|
||||
this.liveCounter = ((AbstractCharacter) target).getLiveCounter();
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
if (this.target.getObjectType().equals(GameObjectType.Building)
|
||||
&& ((Building)this.target).isVulnerable() == false) {
|
||||
_cancelJob();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (this.dot == null || this.target == null || this.action == null || this.source == null || this.eb == null)
|
||||
return;
|
||||
if (AbstractWorldObject.IsAbstractCharacter(target) && ((AbstractCharacter)this.target).getLiveCounter() != liveCounter){
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
return;
|
||||
}
|
||||
if (!this.target.isAlive()){
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
return;
|
||||
}
|
||||
|
||||
this.iteration--;
|
||||
|
||||
if (this.iteration < 0){
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
return;
|
||||
}
|
||||
this.skipSendEffect = true;
|
||||
String stackType = action.getStackType();
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
this.target.addEffect(Integer.toString(action.getUUID()), getTickLength(), this, this.eb, this.trains);
|
||||
else
|
||||
this.target.addEffect(stackType, getTickLength(), this, this.eb, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
eb.startEffect((AbstractCharacter)this.source, this.target, this.trains, this);
|
||||
}
|
||||
this.iteration = action.getDurationInSeconds(trains) / this.dot.getNumIterations();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
|
||||
}
|
||||
@Override
|
||||
protected void doJob() {
|
||||
if (this.target.getObjectType().equals(GameObjectType.Building)
|
||||
&& ((Building) this.target).isVulnerable() == false) {
|
||||
_cancelJob();
|
||||
return;
|
||||
}
|
||||
|
||||
public int getIteration() {
|
||||
return this.iteration;
|
||||
}
|
||||
|
||||
public int getTickLength() {
|
||||
return this.dot.getNumIterations() * 1000;
|
||||
}
|
||||
if (this.dot == null || this.target == null || this.action == null || this.source == null || this.eb == null)
|
||||
return;
|
||||
if (AbstractWorldObject.IsAbstractCharacter(target) && ((AbstractCharacter) this.target).getLiveCounter() != liveCounter) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
return;
|
||||
}
|
||||
if (!this.target.isAlive()) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
return;
|
||||
}
|
||||
|
||||
public int inc() {
|
||||
this.iteration++;
|
||||
return this.iteration;
|
||||
}
|
||||
this.iteration--;
|
||||
|
||||
if (this.iteration < 0) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
return;
|
||||
}
|
||||
this.skipSendEffect = true;
|
||||
String stackType = action.getStackType();
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
this.target.addEffect(Integer.toString(action.getUUID()), getTickLength(), this, this.eb, this.trains);
|
||||
else
|
||||
this.target.addEffect(stackType, getTickLength(), this, this.eb, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
eb.startEffect((AbstractCharacter) this.source, this.target, this.trains, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
|
||||
}
|
||||
|
||||
public int getIteration() {
|
||||
return this.iteration;
|
||||
}
|
||||
|
||||
public int getTickLength() {
|
||||
return this.dot.getNumIterations() * 1000;
|
||||
}
|
||||
|
||||
public int inc() {
|
||||
this.iteration++;
|
||||
return this.iteration;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user