use of main.content.enums.entity.SpellEnums.SPELL_POOL in project Eidolons by IDemiurge.
the class SpellMaster method initSpellpool.
private List<DC_SpellObj> initSpellpool(MicroObj obj, PROPERTY PROP) {
List<DC_SpellObj> spells = new ArrayList<>();
String spellList = obj.getProperty(PROP);
List<String> spellpool;
spellpool = StringMaster.openContainer(spellList);
for (String typeName : spellpool) {
Ref ref = Ref.getCopy(obj.getRef());
ObjType type = DataManager.getType(typeName, DC_TYPE.SPELLS);
if (type == null) {
continue;
}
Map<ObjType, MicroObj> cache = spellCache.get(obj);
if (cache == null) {
cache = new HashMap<>();
spellCache.put(obj, cache);
}
MicroObj spell = cache.get(type);
if (spell == null) {
spell = getGame().createSpell(type, obj, ref);
cache.put(type, spell);
}
SPELL_POOL spellPool = new EnumMaster<SPELL_POOL>().retrieveEnumConst(SPELL_POOL.class, PROP.getName());
if (spellPool != null) {
spell.setProperty(G_PROPS.SPELL_POOL, spellPool.toString());
} else {
LogMaster.log(1, PROP.getName() + " spell pool not found for " + typeName);
}
spells.add((DC_SpellObj) spell);
}
return spells;
}
Aggregations