use of eidolons.entity.obj.DC_Obj 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 eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class ConcealmentRule method getMissChance.
// DEPENDING ON VISIBILITY_LEVEL?
public static int getMissChance(DC_ActiveObj action) {
DC_Obj source = action.getOwnerObj();
Obj target = action.getRef().getTargetObj();
Obj cell = source.getGame().getCellByCoordinate(source.getCoordinates());
// if (source.checkPassive(STANDARD_PASSIVES.DARKVISION))
// return false;
// if (source.checkPassive(STANDARD_PASSIVES.LIGHTVISION))
// return false;
int chance = target.getIntParam(PARAMS.CONCEALMENT) - source.getIntParam(PARAMS.DETECTION) - // - target.getIntParam(PARAMS.NOISE) / 2
source.getIntParam(PARAMS.ACCURACY) - source.getIntParam(PARAMS.ILLUMINATION) + // vision...
cell.getIntParam(PARAMS.CONCEALMENT);
if (chance < 0) {
chance = 0;
}
chance -= source.getIntParam(PARAMS.ILLUMINATION);
if (chance < 0) {
chance += 500;
if (chance < 0)
return -(chance) / 2;
else
return 0;
}
return (chance);
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class EvasionRule method getMissChance.
public static int getMissChance(DC_ActiveObj action) {
DC_Obj source = action.getOwnerObj();
Obj target = action.getRef().getTargetObj();
int chance = target.getIntParam(PARAMS.EVASION) - source.getIntParam(PARAMS.ACCURACY);
return chance;
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class EvasionRule method checkMissed.
public static boolean checkMissed(DC_ActiveObj action) {
DC_Obj source = action.getOwnerObj();
Obj target = action.getRef().getTargetObj();
if (source == null || target == null) {
return false;
}
if (source.checkPassive(UnitEnums.STANDARD_PASSIVES.TRUE_STRIKE)) {
return false;
}
int chance = getMissChance(action);
if (chance <= 0) {
return false;
}
return RandomWizard.chance(chance);
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class BfGridComp method repaintToBuffer.
private void repaintToBuffer() {
Graphics2D g = (Graphics2D) bufferImage.getGraphics();
// TODO imageManager update
for (int i = 0; i < getDisplayedCellsX(); i++) {
for (int j = 0; j < getDisplayedCellsY(); j++) {
if (i + getOffsetX() >= cells.length) {
return;
}
if (j + getOffsetY() >= cells[0].length) {
continue;
}
CellComp cellComp = cells[i + getOffsetX()][j + getOffsetY()];
if (editMode) {
Coordinates c = new Coordinates(i + getOffsetX(), j + getOffsetY());
cellComp.setObjects(getGame().getObjectsOnCoordinate(c));
// cellComp.setOverlayingObjects(getGame().getOverlayingObjects(c));
cellComp.setSizeFactor(zoom);
cellComp.setWidth(getCellWidth());
cellComp.setHeight(getCellHeight());
cellComp.refresh();
}
BufferedImage compImage = cellComp.getPaintImage();
g.drawImage(compImage, getX(i), getY(j), null);
}
}
// DrawMasterStatic.drawDiagonalJoints(zoom, g, getOffsetX(), getOffsetY(), getCellWidth(),
// getCellHeight(), getGame().getBattleFieldManager().getDiagonalJoints());
Unit activeObj = getGame().getManager().getActiveObj();
if (activeObj != null) {
// if (!activeObj.isAnimated())
if (!getGame().getAnimationManager().isStackAnimOverride(activeObj.getCoordinates())) {
drawSelectionGlowOverlay(g, activeObj, false);
}
}
drawUnderlays(g);
DC_Obj infoObj = getGame().getManager().getInfoObj();
if (infoObj != null) {
// if (!activeObj.isAnimated())
if (!getGame().getAnimationManager().isStackAnimOverride(infoObj.getCoordinates())) {
drawSelectionGlowOverlay(g, infoObj, true);
}
}
drawOverlays(g);
if (!editMode) {
DrawMasterStatic.drawWatchInfo(zoom, g);
}
}
Aggregations