Search in sources :

Example 1 with SPELL_POOL

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;
}
Also used : MicroObj(main.entity.obj.MicroObj) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) ArrayList(java.util.ArrayList) DC_SpellObj(eidolons.entity.active.DC_SpellObj) SPELL_POOL(main.content.enums.entity.SpellEnums.SPELL_POOL)

Aggregations

DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 ArrayList (java.util.ArrayList)1 SPELL_POOL (main.content.enums.entity.SpellEnums.SPELL_POOL)1 Ref (main.entity.Ref)1 MicroObj (main.entity.obj.MicroObj)1 ObjType (main.entity.type.ObjType)1