use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.
the class UnitResetter method toBase.
@Override
public void toBase() {
// getEntity().setMode(STD_MODES.NORMAL); ??
// Chronos.mark(toString() + "to base (values)");
getEntity().setMode(null);
if (getEntity().getSpecialEffects() != null) {
getEntity().getSpecialEffects().clear();
}
if (getEntity().getBonusDamage() != null) {
getEntity().getBonusDamage().clear();
}
super.toBase();
// }
if (getEntity().isMine()) {
if (CoreEngine.isLogicTest())
TestMasterContent.addTestGroupSpells(getEntity());
if (CoreEngine.isAnimationTestMode()) {
TestMasterContent.addANIM_TEST_Spells(getEntity());
} else if (CoreEngine.isGuiTestMode()) {
TestMasterContent.addGRAPHICS_TEST_Spells(getEntity());
}
}
if (getChecker().checkClassification(UnitEnums.CLASSIFICATIONS.TALL)) {
getInitializer().addProperty(G_PROPS.STANDARD_PASSIVES, "" + UnitEnums.CLASSIFICATIONS.TALL, true);
}
if (getChecker().checkClassification(UnitEnums.CLASSIFICATIONS.SHORT)) {
getInitializer().addProperty(G_PROPS.STANDARD_PASSIVES, "" + UnitEnums.CLASSIFICATIONS.TALL, true);
}
// Chronos.logTimeElapsedForMark(toString() + "to base (values)");
// Chronos.mark(toString() + "to base (init objects)");
getInitializer().initHeroObjects();
// if (mainHero)
if (!CoreEngine.isArcaneVault()) {
if (game.isSimulation()) {
resetObjects();
resetQuickSlotsNumber();
String value = "";
for (DC_SpellObj s : getEntity().getSpells()) {
if (!s.getProperty(PROPS.SPELL_UPGRADES).isEmpty()) {
value += s.getName() + StringMaster.wrapInParenthesis(s.getProperty(PROPS.SPELL_UPGRADES).replace(";", ",")) + ";";
}
}
if (!value.isEmpty()) {
setProperty(PROPS.SPELL_UPGRADES, value, true);
}
}
}
if (!getChecker().isBfObj()) {
if (!getChecker().isNeutral()) {
if (getChecker().isImmortalityOn()) {
getEntity().addPassive(UnitEnums.STANDARD_PASSIVES.INDESTRUCTIBLE);
}
if (game.isDummyMode()) {
if (getGame().isDummyPlus()) {
getEntity().resetDynamicParam(PARAMS.C_N_OF_COUNTERS);
resetParam(PARAMS.C_STAMINA);
resetParam(PARAMS.C_FOCUS);
resetParam(PARAMS.C_ESSENCE);
resetParam(PARAMS.C_FOCUS);
}
if (!getEntity().getOwner().isMe()) {
setParam(PARAMS.INITIATIVE_MODIFIER, 1);
}
}
}
}
}
use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.
the class DealDamageEffect method applyThis.
@Override
public boolean applyThis() {
if (ref.getTargetObj() == null) {
return false;
}
if (!(ref.getTargetObj() instanceof Unit)) {
// TODO if cell, apply damage to corpses?
return true;
}
if (checkDamageMod(DAMAGE_MODIFIER.QUIET)) {
getRef().setQuiet(true);
} else {
getRef().setQuiet(false);
}
Unit targetObj = (Unit) ref.getTargetObj();
int amount = formula.getAppendedByModifier(ref.getValue(KEYS.FORMULA)).getInt(ref);
DC_ActiveObj active = (DC_ActiveObj) ref.getActive();
boolean spell = active instanceof DC_SpellObj;
initDamageType();
if (!checkDamageMod(DAMAGE_MODIFIER.UNBLOCKABLE)) {
amount = ArmorMaster.getShieldReducedAmountForDealDamageEffect(this, targetObj, amount, active);
}
LogMaster.log(LogMaster.COMBAT_DEBUG, "Effect is dealing damage: " + amount + " to " + ref.getTargetObj().toString());
saveDamageModsToRef();
ref.setValue(KEYS.DAMAGE_TYPE, damage_type.getName());
int damage = DamageDealer.dealDamage(getDamageObject(amount));
return true;
}
use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.
the class CastNewSpellEffect method applyThis.
// TODO spellpower/mastery mods!!!
@Override
public boolean applyThis() {
ObjType type = DataManager.getType(spelltype, DC_TYPE.SPELLS);
Ref REF = new Ref(ref.getGame(), ref.getSource());
Obj obj = game.createSpell(type, ref.getSourceObj().getOwner(), REF);
DC_SpellObj spell = (DC_SpellObj) obj;
spell.setFree(free);
spell.setQuietMode(true);
if (group) {
REF.setGroup(ref.getGroup());
return spell.activatedOn(REF);
}
if (chooseTarget) {
spell.getTargeting().select(REF);
} else {
REF.setTarget(ref.getId(target_key));
}
return spell.activatedOn(REF);
}
use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.
the class AnimationConstructor method preconstructAllForAV.
public static void preconstructAllForAV() {
for (ObjType type : DataManager.getTypes(DC_TYPE.SPELLS)) {
DC_SpellObj active = new DC_SpellObj(type, Player.NEUTRAL, DC_Game.game, new Ref());
AnimData data = null;
try {
int i = 0;
for (ANIM_PART part : ANIM_PART.values()) {
data = new AnimationConstructor().getStandardData(active, part, i);
for (ANIM_VALUES val : ANIM_VALUES.values()) {
String identifier;
switch(val) {
case PARTICLE_EFFECTS:
identifier = "SFX";
break;
case SPRITES:
identifier = "SPRITE";
break;
default:
continue;
}
String value = data.getValue(val);
if (StringMaster.isEmpty(value))
continue;
value = value.replace(PathFinder.getImagePath().toLowerCase(), "");
i++;
PROPERTY prop = ContentManager.findPROP("anim" + "_" + identifier + "_" + part);
if (prop == null)
continue;
type.setProperty(prop, value);
}
}
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
use of eidolons.entity.active.DC_SpellObj in project Eidolons by IDemiurge.
the class ForceRule method isForceEnabled.
private static boolean isForceEnabled(DC_ActiveObj action) {
if (action.isAttackAny()) {
return true;
}
if (action.isSpell()) {
Ref ref = action.getRef();
// TODO won't be initialized here yet!!!
DC_SpellObj spell = (DC_SpellObj) action;
if (spell.isDamageSpell()) {
if (spell.isMissile()) {
if (spell.getResistanceType() == RESISTANCE_TYPE.REDUCE_DAMAGE) {
if (!DamageCalculator.isPeriodic(ref)) {
if (!ref.isTriggered()) {
return true;
}
}
}
}
}
}
return false;
}
Aggregations