Initial refactor of damagetype

This commit is contained in:
2024-04-01 09:19:37 -04:00
parent adfbf87056
commit a29269e335
32 changed files with 447 additions and 380 deletions
+29 -29
View File
@@ -3091,7 +3091,7 @@ public class PlayerCharacter extends AbstractCharacter {
if (this.bonuses != null)
// get rune and effect bonuses
bonus += this.bonuses.getFloatPercentNullZero(ModType.Speed, SourceType.NONE);
bonus += this.bonuses.getFloatPercentNullZero(ModType.Speed, SourceType.None);
// TODO get equip bonus
this.update();
@@ -3595,8 +3595,8 @@ public class PlayerCharacter extends AbstractCharacter {
//calculateModifiedStats();
//update hide and seeInvis levels
if (this.bonuses != null) {
this.hidden = (int) bonuses.getFloat(ModType.Invisible, SourceType.NONE);
this.seeInvis = (int) bonuses.getFloat(ModType.SeeInvisible, SourceType.NONE);
this.hidden = (int) bonuses.getFloat(ModType.Invisible, SourceType.None);
this.seeInvis = (int) bonuses.getFloat(ModType.SeeInvisible, SourceType.None);
} else {
this.hidden = (byte) 0;
this.seeInvis = (byte) 0;
@@ -3664,21 +3664,21 @@ public class PlayerCharacter extends AbstractCharacter {
// TODO modify for equipment
if (this.bonuses != null) {
// modify for effects
strVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.STRENGTH));
dexVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.DEXTERITY));
conVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.CONSTITUTION));
intVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.INTELLIGENCE));
spiVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.SPIRIT));
strVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Strength));
dexVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Dexterity));
conVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Constitution));
intVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Intelligence));
spiVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Spirit));
// apply dex penalty for armor
dexVal *= this.dexPenalty;
// modify percent amounts. DO THIS LAST!
strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.STRENGTH));
dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.DEXTERITY));
conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.CONSTITUTION));
intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.INTELLIGENCE));
spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.SPIRIT));
strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Strength));
dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Dexterity));
conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Constitution));
intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Intelligence));
spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Spirit));
} else
// apply dex penalty for armor
@@ -3774,24 +3774,24 @@ public class PlayerCharacter extends AbstractCharacter {
wbOff = off.template;
//set block if block found
this.bonuses.setBool(ModType.Block, SourceType.NONE, false);
this.bonuses.setBool(ModType.Block, SourceType.None, false);
if (this.baseClass != null && (this.baseClass.getObjectUUID() == 2500 || this.baseClass.getObjectUUID() == 2501))
if (off != null && off.template != null && ItemTemplate.isShield(off))
this.bonuses.setBool(ModType.Block, SourceType.NONE, true);
this.bonuses.setBool(ModType.Block, SourceType.None, true);
//set dodge if rogue
if (this.baseClass != null && this.baseClass.getObjectUUID() == 2502)
this.bonuses.setBool(ModType.Dodge, SourceType.NONE, true);
this.bonuses.setBool(ModType.Dodge, SourceType.None, true);
else
this.bonuses.setBool(ModType.Dodge, SourceType.NONE, false);
this.bonuses.setBool(ModType.Dodge, SourceType.None, false);
//set parry if fighter or thief and no invalid weapon found
this.bonuses.setBool(ModType.Parry, SourceType.NONE, false);
this.bonuses.setBool(ModType.Parry, SourceType.None, false);
if ((this.baseClass != null && this.baseClass.getObjectUUID() == 2500)
|| (this.promotionClass != null && this.promotionClass.getObjectUUID() == 2520))
if (wbMain == null || wbMain.item_weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE)
if (wbOff == null || wbOff.item_weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE)
this.bonuses.setBool(ModType.Parry, SourceType.NONE, true);
this.bonuses.setBool(ModType.Parry, SourceType.None, true);
}
@@ -3890,13 +3890,13 @@ public class PlayerCharacter extends AbstractCharacter {
//apply effects
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE);
s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE);
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.None);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.None);
s += this.bonuses.getFloat(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));
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));
}
@@ -3931,11 +3931,11 @@ public class PlayerCharacter extends AbstractCharacter {
ModType modType = ModType.GetModType(type);
// must be allowed to use this passive
if (!this.bonuses.getBool(modType, SourceType.NONE))
if (!this.bonuses.getBool(modType, SourceType.None))
return 0f;
// must not be stunned
if (this.bonuses.getBool(ModType.Stunned, SourceType.NONE))
if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
return 0f;
// Get base skill amount
@@ -3947,7 +3947,7 @@ public class PlayerCharacter extends AbstractCharacter {
amount = sk.getModifiedAmount();
// Add bonuses
amount += this.bonuses.getFloat(modType, SourceType.NONE);
amount += this.bonuses.getFloat(modType, SourceType.None);
// Add item bonuses and return
if (type.equals(ModType.Dodge) && !fromCombat)
@@ -4381,7 +4381,7 @@ public class PlayerCharacter extends AbstractCharacter {
Vector3fImmutable newLoc = this.getMovementLoc();
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.NONE) || this.getBonuses().getBool(ModType.CannotMove, SourceType.NONE)) {
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
//Target is stunned or rooted. Don't move
this.stopMovement(newLoc);
return;