Project cleanup pre merge.

This commit is contained in:
2023-07-15 09:23:48 -04:00
parent 134b651df8
commit 9bbdef224d
747 changed files with 99704 additions and 101200 deletions
+58 -60
View File
@@ -24,86 +24,84 @@ import engine.powers.poweractions.DeferredPowerPowerAction;
public class DeferredPowerJob extends AbstractEffectJob {
private final DeferredPowerPowerAction def;
private final DeferredPowerPowerAction def;
public DeferredPowerJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, DeferredPowerPowerAction def) {
super(source, target, stackType, trains, action, power, eb);
this.def = def;
}
public DeferredPowerJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, DeferredPowerPowerAction def) {
super(source, target, stackType, trains, action, power, eb);
this.def = def;
}
public DeferredPowerJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, ApplyEffectPowerAction def) {
super(source, target, stackType, trains, action, power, eb);
this.def = null;
}
public DeferredPowerJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, ApplyEffectPowerAction def) {
super(source, target, stackType, trains, action, power, eb);
this.def = null;
}
@Override
protected void doJob() {
//Power ended with no attack, cancel weapon power boost
if (this.source != null && this.source instanceof PlayerCharacter) {
((PlayerCharacter) this.source).setWeaponPower(null);
}
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
}
@Override
protected void doJob() {
//Power ended with no attack, cancel weapon power boost
if (this.source != null && this.source instanceof PlayerCharacter) {
((PlayerCharacter) this.source).setWeaponPower(null);
}
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
}
@Override
protected void _cancelJob() {
//Attack happened.
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
}
@Override
protected void _cancelJob() {
//Attack happened.
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
}
public void attack(AbstractWorldObject tar, float attackRange) {
public void attack(AbstractWorldObject tar, float attackRange) {
if (this.source == null)
return;
if (this.source == null)
return;
if (!AbstractWorldObject.IsAbstractCharacter(tar))
return;
if (!AbstractWorldObject.IsAbstractCharacter(tar))
return;
if (this.power == null)
return;
if (this.power == null)
return;
switch(this.source.getObjectType()){
switch (this.source.getObjectType()) {
case PlayerCharacter:
case PlayerCharacter:
if (def == null) {
//No powers applied, just reset weapon power.
((PlayerCharacter) this.source).setWeaponPower(null);
return;
}
float powerRange = this.power.getWeaponRange();
if (def == null) {
//No powers applied, just reset weapon power.
((PlayerCharacter) this.source).setWeaponPower(null);
return;
}
float powerRange = this.power.getWeaponRange();
// Wtf? Method returns TRUE if rage test fails? Seriously?
// Wtf? Method returns TRUE if rage test fails? Seriously?
//DO valid range check ONLY for weapon powers with range less than attack range.
if (attackRange > powerRange)
if (CombatManager.NotInRange((AbstractCharacter)this.source, tar, powerRange))
return;
//DO valid range check ONLY for weapon powers with range less than attack range.
if (attackRange > powerRange)
if (CombatManager.NotInRange((AbstractCharacter) this.source, tar, powerRange))
return;
//Range check passed, apply power and clear weapon power.
((PlayerCharacter) this.source).setWeaponPower(null);
//Range check passed, apply power and clear weapon power.
((PlayerCharacter) this.source).setWeaponPower(null);
//weapon powers with no deferedpoweraction have null Def, but still have bonuses applied already and will finish here.
//weapon powers with no deferedpoweraction have null Def, but still have bonuses applied already and will finish here.
PowersManager.applyPower((AbstractCharacter) this.source, tar, Vector3fImmutable.ZERO, def.getDeferredPowerID(), this.trains, false);
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
break;
case Mob:
((Mob) this.source).setWeaponPower(null);
if (def == null) {
return;
}
PowersManager.applyPower((AbstractCharacter) this.source, tar, Vector3fImmutable.ZERO, def.getDeferredPowerID(), this.trains, false);
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
break;
PowersManager.applyPower((AbstractCharacter) this.source, tar, Vector3fImmutable.ZERO, def.getDeferredPowerID(), this.trains, false);
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
break;
case Mob:
((Mob) this.source).setWeaponPower(null);
if (def == null) {
return;
}
}
PowersManager.applyPower((AbstractCharacter) this.source, tar, Vector3fImmutable.ZERO, def.getDeferredPowerID(), this.trains, false);
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
break;
}
}
}
}