use of main.entity.Ref in project Eidolons by IDemiurge.
the class DC_WeaponObj method apply.
@Override
public void apply() {
toBase();
super.apply();
// applyMods();
if (!mainHand) {
if (isWeapon()) {
checkApplyOffhandPenalties();
}
} else {
if (hero.getOffhandWeapon() == null) {
checkApplySingleHandBonus();
}
}
Ref ref = getHero().getRef();
if (isRanged()) {
getHero().setRangedWeapon(this);
ref.setID(KEYS.RANGED, getId());
}
if (mainHand) {
ref.setID(KEYS.WEAPON, getId());
} else {
ref.setID(KEYS.OFFHAND, getId());
}
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class BattleFieldObject method kill.
@Override
public boolean kill(Entity killer, boolean leaveCorpse, Boolean quietly) {
if (isDead()) {
return false;
}
boolean ignoreInterrupt = false;
if (quietly == null) {
ignoreInterrupt = true;
quietly = false;
}
if ((game.isDebugMode() && isMine()) || (!ignoreInterrupt && !quietly)) {
if ((game.isDebugMode() && isMine()) || checkPassive(UnitEnums.STANDARD_PASSIVES.INDESTRUCTIBLE)) {
preventDeath();
return false;
}
}
ref.setID(KEYS.KILLER, killer.getId());
Ref REF = Ref.getCopy(killer.getRef());
REF.setTarget(id);
REF.setSource(killer.getId());
if (!quietly) {
if (!getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_IS_BEING_KILLED, REF))) {
if (!ignoreInterrupt) {
return false;
}
}
((BattleFieldObject) killer).applySpecialEffects(SPECIAL_EFFECTS_CASE.ON_KILL, this, REF);
applySpecialEffects(SPECIAL_EFFECTS_CASE.ON_DEATH, ((BattleFieldObject) killer), REF);
if (!ignoreInterrupt) {
if (ref.checkInterrupted()) {
return false;
}
}
}
getGame().getManager().unitDies(this, (Obj) killer, leaveCorpse, quietly);
return true;
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class BfGridComp method initCellsAndMap.
private void initCellsAndMap() {
cells = new CellComp[getCellsX()][getCellsY()];
for (int i = 0; i < getCellsX(); i++) {
for (int j = 0; j < getCellsY(); j++) {
DC_Cell cellEntity = new DC_Cell(i, j, game, new Ref(), game.getDungeon());
Coordinates coordinates = new Coordinates(i, j);
cellEntityMap.put(coordinates, cellEntity);
if (!CoreEngine.isLevelEditor())
continue;
CellComp cell = new CellComp(game, coordinates, this);
getMap().put(coordinates, cell);
cells[i][j] = cell;
}
}
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class ContainerTextElement method getRef.
@Override
protected Ref getRef() {
if (entity == null) {
return null;
}
int id = entity.getId();
Ref ref;
// if (entity.getGame().isSimulation())
// ref = CharacterCreator.getHeroPanel().getHero().getRef();
// else TODO
ref = entity.getRef();
if (entity.getOBJ_TYPE_ENUM() instanceof DC_TYPE) {
switch((DC_TYPE) entity.getOBJ_TYPE_ENUM()) {
case UNITS:
case CHARS:
ref = entity.getRef();
break;
case ACTIONS:
ref.setID(KEYS.ACTIVE, id);
break;
case ARMOR:
ref.setID(KEYS.ARMOR, id);
break;
case ITEMS:
ref.setID(KEYS.ITEM, id);
break;
case SPELLS:
ref.setID(KEYS.SPELL, id);
ref.setID(KEYS.ACTIVE, id);
break;
case WEAPONS:
ref.setID(KEYS.WEAPON, id);
break;
}
}
ref.setID(KEYS.INFO, id);
ref.setInfoEntity(entity);
if (CharacterCreator.getHero() != null) {
if (Game.game.isSimulation()) {
if (entity instanceof ObjType) {
entity = HeroCreator.getObjForType(CharacterCreator.getHero(), (ObjType) entity);
}
}
ref.setSource(CharacterCreator.getHero().getId());
// if (item!=null )
// ref.setSource(item.getRef().getSource());
CharacterCreator.getHero().getRef().setInfoEntity(entity);
}
return ref;
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class Trigger method trigger.
public boolean trigger() {
if (LogMaster.TRIGGER_DEBUG_ON)
LogMaster.log(LogMaster.TRIGGER_DEBUG, toString() + " has been triggered!");
abilities.setForceTargeting(forceTargeting);
if (removeAfterTriggers) {
remove();
}
Ref REF = abilities.getRef().getCopy();
REF.setEvent(event);
boolean result = abilities.activatedOn(REF);
if (result && game.isStarted()) {
// if (
game.getManager().checkForChanges(true);
// game.getManager().refreshAll();
}
return result;
}
Aggregations