use of ultima.DungeonScreen.DungeonRoom in project ultimate-java by pantinor.
the class CombatScreen method useStones.
public void useStones(Stone c1, Stone c2, Stone c3, Stone c4) {
DungeonRoom room = (DungeonRoom) tmap.getProperties().get("dungeonRoom");
if (room != null) {
int mask = c1.getLoc() | c2.getLoc() | c3.getLoc() | c4.getLoc();
int TRUTH = Stone.WHITE.getLoc() | Stone.PURPLE.getLoc() | Stone.GREEN.getLoc() | Stone.BLUE.getLoc();
int LOVE = Stone.WHITE.getLoc() | Stone.YELLOW.getLoc() | Stone.GREEN.getLoc() | Stone.ORANGE.getLoc();
int COURAGE = Stone.WHITE.getLoc() | Stone.RED.getLoc() | Stone.PURPLE.getLoc() | Stone.ORANGE.getLoc();
int attrib = 0;
Item key = null;
switch(room.altarRoomVirtue) {
case COURAGE:
attrib = COURAGE;
key = Item.KEY_C;
break;
case LOVE:
attrib = LOVE;
key = Item.KEY_L;
break;
case TRUTH:
attrib = TRUTH;
key = Item.KEY_T;
break;
}
if (mask == attrib && (party.getSaveGame().items & key.getLoc()) > 0) {
log("Thou doth find the " + key.getDesc());
log("one third of the Three Part Key!");
party.getSaveGame().items |= key.getLoc();
} else {
log("Hmm...No effect!");
}
}
finishPlayerTurn();
}
use of ultima.DungeonScreen.DungeonRoom in project ultimate-java by pantinor.
the class CombatScreen method checkTileAffects.
private void checkTileAffects(PartyMember ap, int x, int y) throws PartyDeathException {
Tile tile = combatMap.getTile(x, y);
if (tile == null || tile.getRule() == null) {
return;
}
TileEffect effect = tile.getRule().getEffect();
context.getParty().applyEffect(ap, effect);
if (effect == TileEffect.FIRE || effect == TileEffect.LAVA) {
Sounds.play(Sound.FIREFIELD);
} else if (effect == TileEffect.POISON || effect == TileEffect.POISONFIELD) {
Sounds.play(Sound.POISON_EFFECT);
} else if (effect == TileEffect.SLEEP) {
Sounds.play(Sound.SLEEP);
}
DungeonRoom room = (DungeonRoom) tmap.getProperties().get("dungeonRoom");
if (room != null) {
for (int i = 0; i < 4; i++) {
Trigger tr = room.triggers[i];
if (tr.tile.getIndex() != 0 && tr.trigX == x && tr.trigY == y) {
Sounds.play(Sound.TRIGGER);
TileRule rule = tr.tile.getRule();
boolean nullplace1 = tr.t1X == 0 && tr.t1Y == 0;
boolean nullplace2 = tr.t2X == 0 && tr.t2Y == 0;
if (rule == TileRule.monster) {
} else {
if (!nullplace1) {
replaceTile(tr.tile.getName(), tr.t1X, tr.t1Y);
}
if (!nullplace2) {
replaceTile(tr.tile.getName(), tr.t2X, tr.t2Y);
}
}
}
}
}
}
Aggregations