stances for guards

This commit is contained in:
2023-09-09 19:23:46 -05:00
parent 96231260bc
commit df3964110a
4 changed files with 153 additions and 58 deletions
+6 -6
View File
@@ -94,14 +94,14 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
protected ConcurrentHashMap<String, Long> timestamps;
protected int atrHandOne;
protected int atrHandTwo;
protected int minDamageHandOne;
protected int maxDamageHandOne;
protected int minDamageHandTwo;
protected int maxDamageHandTwo;
public int minDamageHandOne;
public int maxDamageHandOne;
public int minDamageHandTwo;
public int maxDamageHandTwo;
protected float rangeHandOne;
protected float rangeHandTwo;
protected float speedHandOne;
protected float speedHandTwo;
public float speedHandOne;
public float speedHandTwo;
protected int defenseRating;
protected boolean isActive; // <-Do not use this for deleting character!
protected float altitude = 0; // 0=on terrain, 1=tier 1, 2=tier 2, etc.
+58 -51
View File
@@ -1030,80 +1030,87 @@ public class Mob extends AbstractIntelligenceAgent {
}
public void recalculateStats() {
if(this.isPlayerGuard()){
NPCManager.setMaxHealthForGuard(this);
NPCManager.setAttackRatingForGuard(this);
NPCManager.setDefenseForGuard(this);
NPCManager.setDamageAndSpeedForGuard(this);
}else {
try {
calculateAtrDefenseDamage();
} catch (Exception e) {
Logger.error(this.getMobBaseID() + " /" + e.getMessage());
}
try {
calculateMaxHealthManaStamina();
} catch (Exception e) {
Logger.error(e.getMessage());
}
}
try {
calculateModifiedStats();
} catch (Exception e) {
Logger.error(e.getMessage());
}
try {
calculateAtrDefenseDamage();
} catch (Exception e) {
Logger.error(this.getMobBaseID() + " /" + e.getMessage());
}
try {
calculateMaxHealthManaStamina();
} catch (Exception e) {
Logger.error(e.getMessage());
}
if(this.isSiege())
this.healthMax = 10000;
Resists.calculateResists(this);
}
public void calculateMaxHealthManaStamina() {
float h;
float m;
float s;
float h;
float m;
float s;
h = this.mobBase.getHealthMax();
if (this.isPet()) {
h = this.level * 0.5f * 120;
}
m = this.statSpiCurrent;
s = this.statConCurrent;
h = this.mobBase.getHealthMax();
if (this.isPet()) {
h = this.level * 0.5f * 120;
}
m = this.statSpiCurrent;
s = this.statConCurrent;
// Apply any bonuses from runes and effects
// Apply any bonuses from runes and effects
if (this.bonuses != null) {
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.None);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.None);
s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.None);
if (this.bonuses != null) {
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.None);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.None);
s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.None);
//apply effects percent modifiers. DO THIS LAST!
//apply effects percent modifiers. DO THIS LAST!
h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.None));
m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.None));
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
}
h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.None));
m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.None));
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
}
// Set max health, mana and stamina
// Set max health, mana and stamina
if (h > 0)
this.healthMax = h;
else
this.healthMax = 1;
if (h > 0)
this.healthMax = h;
else
this.healthMax = 1;
if (m > -1)
this.manaMax = m;
else
this.manaMax = 0;
if (m > -1)
this.manaMax = m;
else
this.manaMax = 0;
if (s > -1)
this.staminaMax = s;
else
this.staminaMax = 0;
if (s > -1)
this.staminaMax = s;
else
this.staminaMax = 0;
// Update health, mana and stamina if needed
// Update health, mana and stamina if needed
if (this.getHealth() > this.healthMax)
this.setHealth(this.healthMax);
if (this.getHealth() > this.healthMax)
this.setHealth(this.healthMax);
if (this.mana.get() > this.manaMax)
this.mana.set(this.manaMax);
if (this.mana.get() > this.manaMax)
this.mana.set(this.manaMax);
if (this.stamina.get() > this.staminaMax)
this.stamina.set(staminaMax);
if (this.stamina.get() > this.staminaMax)
this.stamina.set(staminaMax);
}