Search in sources :

Example 1 with DungeonRoom

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();
}
Also used : DungeonRoom(ultima.DungeonScreen.DungeonRoom)

Example 2 with DungeonRoom

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);
                    }
                }
            }
        }
    }
}
Also used : DungeonRoom(ultima.DungeonScreen.DungeonRoom) Trigger(ultima.DungeonScreen.Trigger) Tile(objects.Tile) StaticTiledMapTile(com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile) TiledMapTile(com.badlogic.gdx.maps.tiled.TiledMapTile)

Aggregations

DungeonRoom (ultima.DungeonScreen.DungeonRoom)2 TiledMapTile (com.badlogic.gdx.maps.tiled.TiledMapTile)1 StaticTiledMapTile (com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile)1 Tile (objects.Tile)1 Trigger (ultima.DungeonScreen.Trigger)1