Skip to content

Commit

Permalink
Support Buff improvements/Fabled ShieldMechanic
Browse files Browse the repository at this point in the history
  • Loading branch information
Travja committed Feb 24, 2025
1 parent f1a4a2f commit be81663
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<description>Custom items, combat, and more!</description>

<properties>
<codex.version>1.1.0-R0.10-SNAPSHOT</codex.version>
<codex.version>1.1.0-R0.15-SNAPSHOT</codex.version>
<fabled.version>1.0.4-R0.8-SNAPSHOT</fabled.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class DependencyRequirement {

public static final String MIN_CORE_VERSION = "1.1.0-R0.10-SNAPSHOT";
public static final String MIN_CORE_VERSION = "1.1.0-R0.15-SNAPSHOT";

public static boolean meetsVersion(String requiredVersion, String providedVersion) {
List<Integer> required = splitVersion(requiredVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void onDamageRPGStart(@NotNull DivinityDamageEvent.Start e) {
}
}

double modifiedDamage = meta.getTotalDamage();
double modifiedDamage = meta.getTotalDamage();
double invulnerableProt = 0;
try {
invulnerableProt = e.getOriginalEvent()
Expand Down Expand Up @@ -555,6 +555,9 @@ public void onDamage(DivinityDamageEvent.BeforeScale event) {
Map<DamageAttribute, Double> damageMap = event.getDamageMap();
damageMap.clear();
damageMap.put(damageAttribute, amount);

event.getDefenseMap().putIfAbsent(damageAttribute.getAttachedDefense(), 0D);

success[0] = true;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ public void onVanillaDamage(EntityDamageEvent e) {
}

defenses.putAll(statsVictim.getDefenseTypes(false));
damages.keySet().stream()
.map(DamageAttribute::getAttachedDefense)
.filter(Objects::nonNull)
.forEach((def) -> defenses.putIfAbsent(def, 0D));

// +----------------------------------------------------+
// | Make 'damageStart' to be only additional damage, |
Expand Down Expand Up @@ -451,6 +455,9 @@ private static void scaleValuesWithCore(LivingEntity damager,
damage = AttributeRegistry.scaleAttribute(AttributeRegistry.MELEE_DAMAGE, damager, damage);
}

// Allow Fabled's ShieldMechanic to reduce damage done directly without applying it to defenses
damage = BuffRegistry.scaleDamageForDefense(id.replace("rpgdamage", "rpgdefense"), victim, damage);

damages.put(dmgAtt, damage);
});
}
Expand All @@ -466,7 +473,7 @@ private static void scaleValuesWithCore(LivingEntity damager,

double defense = value;

defense = BuffRegistry.scaleValue(id, damager, defense);
defense = BuffRegistry.scaleValue(id, victim, defense);

defense = AttributeRegistry.scaleAttribute("DIVINITY_defense_" + id.replace("rpgdefense-", ""),
victim,
Expand Down

0 comments on commit be81663

Please sign in to comment.