Search in sources :

Example 11 with DC_SpellObj

use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.

the class HeroManager method spellUpgradeToggle.

public void spellUpgradeToggle(SPELL_UPGRADE selected, Entity entity) {
    Unit hero = CharacterCreator.getHero();
    DC_SpellObj spell = hero.getSpell(entity.getName());
    boolean verbatim = spell.getSpellPool() == SpellEnums.SPELL_POOL.VERBATIM;
    if (!SpellUpgradeMaster.checkUpgrade(verbatim, hero, spell, selected)) {
        DC_SoundMaster.playStandardSound(STD_SOUNDS.FAIL);
        return;
    }
    // result = SpellUpgradeMaster.isUpgraded(spell);
    boolean result = SpellUpgradeMaster.toggleUpgrade(hero, spell, selected);
    if (result) {
        saveHero(hero);
        if (verbatim) {
            hero.modifyParameter(PARAMS.XP, -SpellUpgradeMaster.getXpCost(entity, hero, selected));
        }
        DC_SoundMaster.playStandardSound(STD_SOUNDS.SPELL_UPGRADE_LEARNED);
    } else {
        DC_SoundMaster.playStandardSound(STD_SOUNDS.SPELL_UPGRADE_UNLEARNED);
    }
    if (!verbatim) {
        update(hero);
    }
}
Also used : DC_SpellObj(eidolons.entity.active.DC_SpellObj) Unit(eidolons.entity.obj.unit.Unit)

Example 12 with DC_SpellObj

use of eidolons.entity.active.DC_SpellObj 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)

Example 13 with DC_SpellObj

use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.

the class DebugMaster method executeHiddenDebugFunction.

public Object executeHiddenDebugFunction(HIDDEN_DEBUG_FUNCTIONS func) {
    executedFunctions.push(func.toString());
    Unit infoObj;
    try {
        infoObj = (Unit) getObj();
    } catch (Exception e) {
        infoObj = game.getManager().getActiveObj();
    }
    switch(func) {
        case WRITE_GROUP:
            Entity entity = DC_Game.game.getValueHelper().getEntity();
            if (entity == null) {
                break;
            }
            XML_Writer.writeXML_ForTypeGroup(entity.getOBJ_TYPE_ENUM(), entity.getGroupingKey());
        case WRITE:
            if (!(DC_Game.game.getValueHelper().getEntity() instanceof ObjType)) {
                break;
            }
            XML_Writer.writeXML_ForTypeGroup(DC_Game.game.getValueHelper().getEntity().getOBJ_TYPE_ENUM());
            break;
        case WRITE_TYPE:
            if (!(DC_Game.game.getValueHelper().getEntity() instanceof ObjType)) {
                break;
            }
            XML_Writer.writeXML_ForType((ObjType) DC_Game.game.getValueHelper().getEntity());
            break;
        case TOGGLE_AV_MODE:
            CoreEngine.setArcaneVault(!CoreEngine.isArcaneVault());
            CoreEngine.setArcaneVaultMode(true);
            break;
        case RECONSTRUCT:
            {
                for (ActiveObj obj : infoObj.getPassives()) {
                    obj.setConstructed(false);
                }
                for (ActiveObj obj : infoObj.getActives()) {
                    obj.setConstructed(false);
                }
                break;
            }
        case RELOAD_TYPES:
            {
                XML_Reader.readTypes(false, true);
                game.initObjTypes();
                break;
            }
        case RESTART_GAME:
            // TODO     executeDebugFunction(KILL_ALL_UNITS);
            // DC_ObjInitializer.processUnitDataString(game.getPlayer(true),
            // game.getPlayerParty(), game);
            game.getManager().unitActionCompleted(null, false);
            break;
        case BF_RESURRECT_ALL:
            break;
        case DISPLAY_EVENT_LOG:
            break;
        case DISPLAY_REF:
            display(game.getManager().getInfoObj().getName() + "'s REF:", game.getManager().getInfoObj().getRef() + "");
            break;
        case DISPLAY_TRIGGERS:
            // display("Triggers: ", game.getState().getAttachedTriggers());
            displayList("Triggers: ", game.getState().getTriggers(), 1);
            break;
        case DISPLAY_STATE:
            display("State: ", game.getState());
            break;
        case DISPLAY_EFFECTS:
            displayList("Effects ", game.getState().getEffects(), 1);
            break;
        case DISPLAY_OBJECTS:
            for (OBJ_TYPE sub : game.getState().getGame().getState().getObjMaps().keySet()) {
                displayList(sub + ": ", game.getState().getGame().getState().getObjMaps().get(sub).keySet(), 1);
            }
        case DISPLAY_UNITS:
            displayList("Units ", game.getState().getGame().getUnits(), 1);
            break;
        case DISPLAY_UNIT_INFO:
            display("INFO OBJ: ", getUnitInfo(game.getManager().getInfoObj()));
            break;
        case HERO_ADD_ALL_SPELLS:
            for (ObjType type : DataManager.getTypes(DC_TYPE.SPELLS)) {
                Unit hero = (Unit) game.getManager().getInfoObj();
                if (LibraryManager.checkHeroHasSpell(hero, type)) {
                    continue;
                }
                LibraryManager.addVerbatimSpell(hero, type);
                DC_SpellObj spell = new DC_SpellObj(type, hero.getOriginalOwner(), hero.getGame(), hero.getRef());
                hero.getSpells().add(spell);
            }
            break;
        default:
            break;
    }
    return null;
}
Also used : Entity(main.entity.Entity) OBJ_TYPE(main.content.OBJ_TYPE) C_OBJ_TYPE(main.content.C_OBJ_TYPE) ActiveObj(main.entity.obj.ActiveObj) ObjType(main.entity.type.ObjType) DC_SpellObj(eidolons.entity.active.DC_SpellObj) Unit(eidolons.entity.obj.unit.Unit)

Example 14 with DC_SpellObj

use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.

the class SpellCondition method check.

@Override
public boolean check(Ref ref) {
    if (!(ref.getMatchObj() instanceof DC_SpellObj)) {
        return false;
    }
    DC_SpellObj spell = (DC_SpellObj) ref.getMatchObj();
    Unit hero = (Unit) ref.getSourceObj();
    if (!hero.getSpells().contains(spell)) {
        return false;
    }
    return true;
}
Also used : DC_SpellObj(eidolons.entity.active.DC_SpellObj) Unit(eidolons.entity.obj.unit.Unit)

Example 15 with DC_SpellObj

use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.

the class RadialSpellAspect method getItems.

@Override
public List<RADIAL_ITEM> getItems(Unit source) {
    ArrayList<RADIAL_ITEM> list = new ArrayList<>();
    List<DC_SpellObj> spells = new ArrayList<>(source.getSpells());
    if (spells.size() < maxPlainSize) {
        spells.forEach(spell -> list.add(new EntityNode(spell)));
        return list;
    }
    spells.removeIf(spell -> !spell.getAspect().toString().equalsIgnoreCase(aspect.toString()));
    for (SPELL_GROUP g : aspect.groups) {
        List<DC_SpellObj> group = new ArrayList<>(spells);
        group.removeIf(spell -> !spell.getSpellGroup().equals(g));
        if (group.size() > 0) {
            list.add(new RadialSpellGroup(g));
        }
    }
    return list;
}
Also used : SPELL_GROUP(main.content.enums.entity.SpellEnums.SPELL_GROUP) ArrayList(java.util.ArrayList) DC_SpellObj(eidolons.entity.active.DC_SpellObj)

Aggregations

DC_SpellObj (eidolons.entity.active.DC_SpellObj)22 Unit (eidolons.entity.obj.unit.Unit)8 Ref (main.entity.Ref)6 ObjType (main.entity.type.ObjType)6 ArrayList (java.util.ArrayList)3 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 SPELL_GROUP (main.content.enums.entity.SpellEnums.SPELL_GROUP)2 PROPERTY (main.content.values.properties.PROPERTY)2 Obj (main.entity.obj.Obj)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_QuickItemAction (eidolons.entity.active.DC_QuickItemAction)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1 DC_Cell (eidolons.entity.obj.DC_Cell)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Action (eidolons.game.battlecraft.ai.elements.actions.Action)1 AiQuickItemAction (eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction)1 ArenaBattleMaster (eidolons.game.battlecraft.logic.battle.arena.ArenaBattleMaster)1 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)1