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);
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations