From f9a699cf5f2c5bb5bb206cc6093b76967a787718 Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Tue, 29 Dec 2020 18:30:32 -0500 Subject: Implement 'effect groups' as an explicit concept --- src/main/java/tlIItools/EffectGroup.java | 74 ++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/main/java/tlIItools/EffectGroup.java (limited to 'src/main/java/tlIItools/EffectGroup.java') diff --git a/src/main/java/tlIItools/EffectGroup.java b/src/main/java/tlIItools/EffectGroup.java new file mode 100644 index 00000000..29e51d25 --- /dev/null +++ b/src/main/java/tlIItools/EffectGroup.java @@ -0,0 +1,74 @@ +package tlIItools; + +import java.util.*; + +public class EffectGroup { + /** The name of the effect. */ + public String name; + /** The specific effect that happens. */ + public String type; + /** Damage type for the effect, if applicable. */ + public String damageType = "physical"; + /** Whether or not we have a duration or not. */ + public boolean hasDuration; + /** The name of the stat that applies to this affect. */ + public String statName; + /** Whether or not this stat is a bonus value. */ + public boolean isStatBonus; + /** Whether or not this uses the owners level to modify any applicable graph. */ + public boolean ownerLevel; + /** Whether or not a graph is used for this effect. */ + public boolean useGraph = true; + /** The graph to use instead of the default graph. */ + public String graphOverride; + /** Whether this effect can stack with itself. */ + public boolean exclusive; + /** Whether or not this effect is a 'transfer' effect (Applied to the enemy on a hit). */ + public boolean isTransfer; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append(name); + sb.append(type); + sb.append(damageType); + sb.append(hasDuration); + sb.append(statName); + sb.append(isStatBonus); + sb.append(ownerLevel); + sb.append(graphOverride); + sb.append(useGraph); + sb.append(exclusive); + sb.append(isTransfer); + + return sb.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(damageType, exclusive, graphOverride, hasDuration, + isStatBonus, isTransfer, name, ownerLevel, statName, type, useGraph); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + + EffectGroup other = (EffectGroup) obj; + + return Objects.equals(damageType, other.damageType) + && Objects.equals(graphOverride, other.graphOverride) + && Objects.equals(name, other.name) + && Objects.equals(statName, other.statName) + && Objects.equals(type, other.type) + && exclusive == other.exclusive + && hasDuration == other.hasDuration + && isStatBonus == other.isStatBonus + && isTransfer == other.isTransfer + && ownerLevel == other.ownerLevel + && useGraph == other.useGraph; + } +} \ No newline at end of file -- cgit v1.2.3