Compare monster type restrictions as MonsterType

PowersBase.monsterTypeRestrictions is now an EnumSet<MonsterType>
(DB values Siege/Centaur/Dwarf/Vampire read with CacheParserUtil.readEnum).
MobBase gets monsterType from its race rune's rune_sub_type (all 2380
RACE runes convert); players use RaceType.getMonsterType(). No string
compares and no rune lookup per cast. Same results as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-23 15:59:37 -04:00
1 parent 7b58211386
commit a6f2495e57
3 files changed
+23 -12

No files matched your search

+7 -4
View File
@@ -9,17 +9,20 @@
package engine.powers;
import engine.mbEnums.MonsterType;
import engine.mbEnums.PowerCategoryType;
import engine.mbEnums.PowerTargetType;
import engine.parsers.cache.CacheParserUtil;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.EnumSet;
public class PowersBase {
public final ArrayList<String> monsterTypeRestrictions = new ArrayList<>();
public final EnumSet<MonsterType> monsterTypeRestrictions = EnumSet.noneOf(MonsterType.class);
public final ArrayList<ActionsBase> actions = new ArrayList<>();
public final ArrayList<PowerPrereq> effectPrereqs = new ArrayList<>();
public final ArrayList<PowerPrereq> targetEffectPrereqs = new ArrayList<>();
@@ -273,13 +276,13 @@ public class PowersBase {
this.requiresHitRoll = true;
ct = rs.getString("monsterTypeRestrict1").trim();
if (!ct.isEmpty())
this.monsterTypeRestrictions.add(ct);
this.monsterTypeRestrictions.add(CacheParserUtil.readEnum(MonsterType.class, ct, this.UUID, "monsterTypeRestrict1"));
ct = rs.getString("monsterTypeRestrict2").trim();
if (!ct.isEmpty())
this.monsterTypeRestrictions.add(ct);
this.monsterTypeRestrictions.add(CacheParserUtil.readEnum(MonsterType.class, ct, this.UUID, "monsterTypeRestrict2"));
ct = rs.getString("monsterTypeRestrict3").trim();
if (!ct.isEmpty())
this.monsterTypeRestrictions.add(ct);
this.monsterTypeRestrictions.add(CacheParserUtil.readEnum(MonsterType.class, ct, this.UUID, "monsterTypeRestrict3"));
}
public void setTargetType(String targetType) {