use of main.content.enums.entity.UnitEnums.COUNTER in project Eidolons by IDemiurge.
the class DC_CounterMaster method getCounterPriority.
public static float getCounterPriority(String counterName, DC_Obj target) {
if (target instanceof Unit) {
Unit heroObj = (Unit) target;
String realName = CounterMaster.findCounter(counterName);
switch(new EnumMaster<COUNTER>().retrieveEnumConst(COUNTER.class, realName)) {
case Blaze:
if (!target.getGame().getRules().getBlazeRule().checkApplies(heroObj)) {
return 0;
}
break;
case Bleeding:
if (!target.getGame().getRules().getBleedingRule().checkApplies(heroObj)) {
return 0;
}
break;
case Blight:
if (!target.getGame().getRules().getBlightRule().checkApplies(heroObj)) {
return 0;
}
break;
case Corrosion:
break;
case Despair:
break;
case Disease:
if (!target.getGame().getRules().getDiseaseRule().checkApplies(heroObj)) {
return 0;
}
break;
case Ensnared:
if (!target.getGame().getRules().getEnsnareRule().checkApplies(heroObj)) {
return 0;
}
break;
case Freeze:
if (!target.getGame().getRules().getFreezeRule().checkApplies(heroObj)) {
return 0;
}
break;
case Hatred:
break;
case Lust:
break;
case Madness:
break;
case Moist:
break;
case Poison:
if (!target.getGame().getRules().getPoisonRule().checkApplies(heroObj)) {
return 0;
}
break;
case Rage:
break;
case Soul:
break;
case Undying:
break;
default:
break;
}
}
return CounterMaster.getCounterPriority(counterName, target);
}
use of main.content.enums.entity.UnitEnums.COUNTER in project Eidolons by IDemiurge.
the class SlotItem method drawCounters.
private ImageIcon drawCounters(Image image, Entity coatedObj) {
int x = 0;
int y = 0;
BufferedImage bufferedImage = ImageManager.getBufferedImage(image);
Graphics g = bufferedImage.getGraphics();
for (COUNTER c : CoatingRule.COATING_COUNTERS) {
if (coatedObj.getCounter(c.getName()) > 0) {
// g.drawImage(c.getImage(), x, y, null);
x++;
}
}
return new ImageIcon(bufferedImage);
}
use of main.content.enums.entity.UnitEnums.COUNTER in project Eidolons by IDemiurge.
the class CounterMasterAdvanced method afterRoundEnds.
public static void afterRoundEnds(Unit unit) {
// some interactions should happen immediately - e.g. moist vs blaze
// so we need to Interact, Convert and Transfer... what's the order? probably exactly that!
Map<COUNTER, Integer> map = createCounterMap(unit);
map.forEach((counter, value) -> map.forEach((counter2, value2) -> {
if (counter != counter2) {
COUNTER_INTERACTION interaction = getInteraction(counter, counter2);
int max = getMaxInteractionValue(unit, counter, counter2, value, value2);
interact(counter, counter2, interaction, max, unit);
}
}));
Map<COUNTER, Integer> convertMap = createCounterMap(unit);
map.forEach((counter, value) -> {
COUNTER counter2 = getConvertion(counter);
int max = getMaxConvertionValue(unit, counter, counter2, value);
convertCounters(counter, counter2, max, unit);
});
Map<COUNTER, Integer> transferMap = createCounterMap(unit);
map.forEach((counter, value) -> map.forEach((counter2, value2) -> {
if (counter != counter2) {
COUNTER_INTERACTION interaction = getInteraction(counter, counter2);
int max = getMaxInteractionValue(unit, counter, counter2, value, value2);
interact(counter, counter2, interaction, max, unit);
}
}));
}
use of main.content.enums.entity.UnitEnums.COUNTER in project Eidolons by IDemiurge.
the class CoatingRule method unitIsHit.
public static void unitIsHit(BattleFieldObject target, Unit source, boolean offhand, DC_ActiveObj action, Attack attack, DC_Obj weapon) {
boolean throwing = false;
// DC_WeaponObj weaponObj = (DC_WeaponObj) weapon;
if (action.isRanged()) {
if (action.getRef().getObj(KEYS.RANGED) != null) {
if (!action.isThrow()) {
if (action.getRef().getObj(KEYS.RANGED).getRef().getObj(KEYS.AMMO) != null) {
weapon = (DC_Obj) action.getRef().getObj(KEYS.RANGED).getRef().getObj(KEYS.AMMO);
}
}
}
}
if (action instanceof DC_QuickItemAction) {
weapon = (DC_Obj) action.getRef().getObj(KEYS.ITEM);
throwing = true;
}
DC_Obj armor = (DC_Obj) target.getRef().getObj(KEYS.ARMOR);
for (COUNTER c : COATING_COUNTERS) {
boolean ranged = action.isRanged() || throwing;
applyCounters(target, weapon, source, c, action, throwing);
if (// TODO throwing doesn't count?
ranged) {
continue;
}
// counters could have effect on items as well, durability at least
if (armor != null) {
applyCounters(source, armor, target, c, action, throwing);
}
}
}
use of main.content.enums.entity.UnitEnums.COUNTER in project Eidolons by IDemiurge.
the class CounterMasterAdvanced method interact.
public static void interact(COUNTER from, COUNTER to, COUNTER_INTERACTION interactionType, Integer max, Unit unit) {
switch(interactionType) {
case CONVERT_TO:
COUNTER counter = to;
to = from;
from = counter;
convertCounters(from, to, max, unit);
break;
case CONVERT_FROM:
convertCounters(from, to, max, unit);
break;
case DELETE_OTHER:
// TODO max defined by from!
removeCounters(to, max, unit);
break;
case DELETE_SELF:
removeCounters(from, max, unit);
break;
case MUTUAL_DELETION:
break;
case TRANSFORM_UP:
to = from.getUp();
convertCounters(from, to, max, unit);
break;
case TRANSFORM_DOWN:
to = from.getDown();
convertCounters(from, to, max, unit);
break;
}
}
Aggregations