use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ActiveResetter method applyPenalties.
protected void applyPenalties() {
if (getEntity().getActionGroup() == ACTION_TYPE_GROUPS.MODE) {
return;
}
Unit ownerObj = getOwnerObj();
Integer sta = ownerObj.getIntParam(PARAMS.STAMINA_PENALTY);
Integer ap = ownerObj.getIntParam(PARAMS.AP_PENALTY);
Integer ess = ownerObj.getIntParam(PARAMS.ESSENCE_PENALTY);
Integer foc = ownerObj.getIntParam(PARAMS.FOCUS_PENALTY);
Integer cp = ownerObj.getIntParam(PARAMS.CP_PENALTY);
if (getHandler().isCounterMode()) {
ap = MathMaster.applyModIfNotZero(ap, ownerObj.getIntParam(PARAMS.COUNTER_CP_PENALTY));
sta = MathMaster.applyModIfNotZero(sta, ownerObj.getIntParam(PARAMS.COUNTER_STAMINA_PENALTY));
}
if (getHandler().isInstantMode()) {
ap = MathMaster.applyModIfNotZero(ap, ownerObj.getIntParam(PARAMS.INSTANT_CP_PENALTY));
sta = MathMaster.applyModIfNotZero(sta, ownerObj.getIntParam(PARAMS.INSTANT_STAMINA_PENALTY));
}
if (getHandler().isAttackOfOpportunityMode()) {
ap = MathMaster.applyModIfNotZero(ap, ownerObj.getIntParam(PARAMS.AOO_CP_PENALTY));
sta = MathMaster.applyModIfNotZero(sta, ownerObj.getIntParam(PARAMS.AOO_STAMINA_PENALTY));
}
switch(getEntity().getActionGroup()) {
case ATTACK:
// .getWellFormattedString(ACTION_TAGS.OFF_HAND + ""));
if (getEntity().isOffhand()) {
ap += ownerObj.getIntParam(PARAMS.OFFHAND_ATTACK_AP_PENALTY, false);
sta += ownerObj.getIntParam(PARAMS.OFFHAND_ATTACK_STA_PENALTY, false);
} else {
ap += ownerObj.getIntParam(PARAMS.ATTACK_AP_PENALTY, false);
sta += ownerObj.getIntParam(PARAMS.ATTACK_STA_PENALTY, false);
}
if (getEntity().isThrow()) {
sta += 25 * (EnumMaster.getEnumConstIndex(WEAPON_SIZE.class, getOwnerObj().getWeapon(getEntity().isOffhand()).getWeaponSize()) - 1);
// TODO
}
break;
case MOVE:
FlyingRule.checkAddMoveCostReductions(ownerObj);
TerrainRule.addMoveCost(getEntity());
sta += ownerObj.getIntParam(PARAMS.MOVE_STA_PENALTY, false);
ap += ownerObj.getIntParam(PARAMS.MOVE_AP_PENALTY, false);
break;
case SPELL:
ap += ownerObj.getIntParam(PARAMS.SPELL_AP_PENALTY, false);
sta += ownerObj.getIntParam(PARAMS.SPELL_STA_PENALTY, false);
ess += ownerObj.getIntParam(PARAMS.SPELL_ESS_PENALTY, false);
foc += ownerObj.getIntParam(PARAMS.SPELL_FOC_PENALTY, false);
break;
case TURN:
ap += ownerObj.getIntParam(PARAMS.MOVE_AP_PENALTY, false);
break;
case HIDDEN:
ap += ownerObj.getIntParam(PARAMS.ATTACK_AP_PENALTY, false);
sta += ownerObj.getIntParam(PARAMS.ATTACK_STA_PENALTY, false);
break;
}
getEntity().modifyParamByPercent(PARAMS.CP_COST, cp, true);
getEntity().modifyParamByPercent(PARAMS.STA_COST, sta, true);
getEntity().modifyParamByPercent(PARAMS.AP_COST, ap, true);
getEntity().modifyParamByPercent(PARAMS.ESS_COST, ess, true);
getEntity().modifyParamByPercent(PARAMS.FOC_COST, foc, true);
getEntity().modifyParamByPercent(PARAMS.FOC_REQ, foc, false);
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class HC_SequenceMaster method chooseNewMember.
public void chooseNewMember(Party party) {
Unit leader = party.getLeader();
Conditions filterConditions = new Conditions() {
@Override
public boolean check(Ref ref) {
return super.check(leader.getRef());
}
};
OrConditions orConditions = new OrConditions();
// StringContainersComparison principlesCondition = new
// StringContainersComparison(
// "{SOURCE_" + G_PROPS.PRINCIPLES + "}", "{MATCH_"
// + G_PROPS.PRINCIPLES + "}");
// orConditions.add(principlesCondition);
// PartyManager
// Conditions principlesConditions =
// PartyManager.getPrincipleConditions(party);
// orConditions.add(principlesConditions);
// now gradual! TODO
// StringComparison deityCondition = new StringComparison("{SOURCE_"
// + G_PROPS.DEITY + "}", "{MATCH_" + G_PROPS.DEITY + "}", true);
//
// orConditions.add(new Conditions(new NotCondition(new PropCondition(
// G_PROPS.DEITY, "" + STD_DEITY_TYPE_NAMES.Faithless, true)),
// deityCondition));
// filterConditions.add(orConditions);
NotCondition noDuplicatesCondition = new NotCondition(new StringContainersComparison(true, StringMaster.getValueRef(KEYS.PARTY, PROPS.MEMBERS), StringMaster.getValueRef(KEYS.MATCH, G_PROPS.NAME), false));
filterConditions.add(noDuplicatesCondition);
if (CharacterCreator.isArcadeMode()) {
NumericCondition lvlCondition = new NumericCondition(false, StringMaster.getValueRef(KEYS.PARTY, PARAMS.LEVEL) + "+1", StringMaster.getValueRef(KEYS.MATCH, PARAMS.HERO_LEVEL));
filterConditions.add(lvlCondition);
}
// filterConditions.setRef();
launchEntitySelection(DC_TYPE.CHARS, MainManager.getPresetGroup(), filterConditions, leader, InfoMaster.CHOOSE_MEMBER);
selection = SELECTION_TYPES.NEW_MEMBER_SELECTION;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class Launcher method launchHC.
public static void launchHC(boolean arcadeMode, Unit... heroes) {
Game.game.setSimulation(true);
if (!isDataInitialized()) {
initFullData();
// simulationInit();
}
CharacterCreator.setPartyMode(true);
for (Unit hero : heroes) {
CharacterCreator.addHero(hero, true);
}
setView(CharacterCreator.getTabPanel(), VIEWS.HC);
CharacterCreator.refreshGUI();
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class DefaultActionHandler method pickAutomatically.
//
private static DC_ActiveObj pickAutomatically(List<DC_ActiveObj> subActions, BattleFieldObject target) {
DC_ActiveObj pick = null;
int max = 0;
for (DC_ActiveObj attack : subActions) {
if (attack.getActiveWeapon().isNatural())
if (attack.getOwnerObj().getWeapon(attack.isOffhand()) != null)
continue;
if (!attack.canBeActivated(attack.getRef(), true))
continue;
if (!attack.canBeTargeted(target.getId()))
continue;
DC_PriorityManager.toggleImplementation(new PriorityManagerImpl(target.getGame().getAiManager()) {
@Override
public Unit getUnit() {
return attack.getOwnerObj();
}
});
int priority = 0;
try {
priority = DC_PriorityManager.getAttackPriority(attack, target);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
} finally {
DC_PriorityManager.toggleImplementation(null);
}
if (priority >= max) {
pick = attack;
max = priority;
}
}
return pick;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class DefaultActionHandler method leftClickCell.
public static boolean leftClickCell(boolean turn, boolean moveTo, int gridX, int gridY) {
Unit source = null;
try {
source = Eidolons.getGame().getManager().getActiveObj();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
if (source == null)
return false;
if (source.isAiControlled())
return false;
Coordinates c = new Coordinates(gridX, gridY);
if (turn) {
return turnToMotion(source, c);
}
if (moveTo) {
return moveToMotion(source, c);
}
if (source.getGame().isDebugMode()) {
return doDebugStuffCell(source, c);
}
if (c.x - source.getX() > 1) {
return false;
}
if (c.y - source.getY() > 1) {
return false;
}
DC_UnitAction action = getMoveToCellAction(source, c);
if (action == null) {
return false;
}
Obj target = action.getTargeting() instanceof SelectiveTargeting ? Eidolons.getGame().getCellByCoordinate(c) : null;
Context context = new Context(source, target);
return activate(context, action);
}
Aggregations