use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class HitAnim method resetSprites.
@Override
protected void resetSprites() {
sprites.clear();
spriteType = getSpriteType((BattleFieldObject) getRef().getTargetObj());
hitType = getHitType(getActive(), spriteType);
String spritePath = StrPathBuilder.build(getHitSpritesPath(), spriteType.name(), hitType.spritePath) + ".txt";
// + ".png";
// SpriteAnimation sprite = SpriteAnimationFactory.getSpriteAnimation(spritePath);
// scale?
SmartTextureAtlas atlas = SmartTextureAtlas.getAtlas(PathFinder.getImagePath() + spritePath);
if (atlas == null)
return;
Array<AtlasRegion> regions = atlas.getRegions();
SpriteAnimation sprite = SpriteAnimationFactory.getSpriteAnimation(regions, getDuration() / regions.size, 1);
if (getRef().getTargetObj() instanceof Unit)
sprite.setColor(getColorForSprite((Unit) getRef().getTargetObj()));
sprites.add(sprite);
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class MoveAnimation method start.
@Override
public void start() {
try {
super.start();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
Unit unit = (Unit) getRef().getSourceObj();
if (!ListMaster.isNotEmpty(EffectFinder.getEffectsOfClass(getActive(), MoveEffect.class)))
unit = (Unit) getRef().getTargetObj();
BaseView actor = DungeonScreen.getInstance().getGridPanel().getViewMap().get(unit);
if (!DungeonScreen.getInstance().getGridPanel().detachUnitView(unit)) {
return;
}
// DungeonScreen.getInstance().getGridStage().addActor(actor);
// actor.setPosition(getX(), getY());
getAction().setStartPointY(actor.getY());
getAction().setStartPointX(actor.getX());
actor.addAction(getAction());
action.setTarget(actor);
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class VisibilityCondition method check.
@Override
public boolean check(Ref ref) {
if (!(ref.getObj(KEYS.MATCH) instanceof BfObj)) {
return false;
}
DC_Obj match = (DC_Obj) ref.getObj(KEYS.MATCH);
boolean result = false;
if (this.match == null && this.source == null) {
if (p_vision != null) {
PLAYER_VISION playerVision = match.getActivePlayerVisionStatus();
if (game.getManager().getActiveObj().isMine() != ref.getSourceObj().isMine()) {
if (ref.getSourceObj().isMine()) {
playerVision = match.getPlayerVisionStatus(false);
} else {
// TODO for enemy unit on player's unit...
}
}
if (playerVision == p_vision) {
return true;
}
}
UNIT_VISION visionStatus = match.getUnitVisionStatus();
if (!ref.getSourceObj().isActiveSelected()) {
visionStatus = match.getGame().getVisionMaster().getSightMaster().getUnitVisibilityStatus(match, (Unit) ref.getSourceObj());
}
return visionStatus.isSufficient(u_vision);
}
if (p_vision != null) {
Unit unit = (Unit) ref.getObj(source);
result = unit.getActivePlayerVisionStatus() == p_vision;
} else if (u_vision != null) {
match = (DC_Obj) ref.getObj(this.match);
// if (((DC_Game) game).getManager().isAI_Turn()) { what's the idea?
Unit activeObj = (Unit) ref.getObj(source);
result = ((DC_Game) game).getVisionMaster().getUnitVisibilityStatus(match, activeObj).isSufficient(u_vision);
// }
}
return result;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ClassTreeCondition method check.
@Override
public boolean check(Ref ref) {
ObjType type = DataManager.getType(className, DC_TYPE.CLASSES);
if (type == null) {
return true;
}
Unit hero = (Unit) ref.getSourceObj();
for (DC_FeatObj c : hero.getClasses()) {
if (c.getType().equals(type)) {
return true;
}
if (c.getProperty(G_PROPS.CLASS_GROUP).equalsIgnoreCase(type.getProperty(G_PROPS.CLASS_GROUP))) {
if (c.getIntParam(PARAMS.CIRCLE) >= type.getIntParam(PARAMS.CIRCLE)) {
return false;
}
}
}
return true;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ItemCondition method check.
@Override
public boolean check(Ref ref) {
if (ref.getGame().isSimulation()) {
return true;
}
if (slot == null) {
slot = (weapon) ? ItemEnums.ITEM_SLOT.MAIN_HAND.toString() : ItemEnums.ITEM_SLOT.ARMOR.toString();
}
Entity item;
Unit unit = (Unit) ref.getObj(obj_ref);
if (unit == null) {
return false;
}
if (slot.equalsIgnoreCase(KEYS.RANGED.toString())) {
item = unit.getRef().getObj(KEYS.RANGED);
} else {
if (slot.equalsIgnoreCase("weapon"))
item = unit.getItem(!ref.getActive().isOffhand() ? ITEM_SLOT.MAIN_HAND : ITEM_SLOT.OFF_HAND);
else
item = unit.getItem(new EnumMaster<ITEM_SLOT>().retrieveEnumConst(ITEM_SLOT.class, slot, true));
}
if (item == null) {
return false;
}
if (// any item in the slot
prop == null) {
return true;
}
String string = item.getProp(prop);
return new StringComparison(string, val, strict).preCheck(ref);
// String prop2 = ref.getObj(obj_string).getProp(slot);
// if (StringMaster.isEmpty(prop2)) {
// try {
// prop2 = "" + ref.getObj(obj_string).getRef().getObj(slot).getId();
// } catch (Exception e) {
// return false;
// }
// }
// item = DataManager.getType(prop2, C_OBJ_TYPE.ITEMS);
// return StringMaster.compare(string, val, true);
}
Aggregations