Search in sources :

Example 1 with PartyDeathException

use of util.PartyDeathException in project ultimate-java by pantinor.

the class CombatScreen method keyUp.

@Override
public boolean keyUp(int keycode) {
    PartyMember ap = party.getActivePartyMember();
    Creature active = ap.combatCr;
    try {
        if (keycode == Keys.SPACE || ap.isDisabled()) {
            log("Pass");
        } else if (keycode == Keys.UP) {
            if (preMove(active, Direction.NORTH)) {
                active.currentY--;
                active.currentPos = getMapPixelCoords(active.currentX, active.currentY);
                checkTileAffects(ap, active.currentX, active.currentY);
            }
        } else if (keycode == Keys.DOWN) {
            if (preMove(active, Direction.SOUTH)) {
                active.currentY++;
                active.currentPos = getMapPixelCoords(active.currentX, active.currentY);
                checkTileAffects(ap, active.currentX, active.currentY);
            }
        } else if (keycode == Keys.RIGHT) {
            if (preMove(active, Direction.EAST)) {
                active.currentX++;
                active.currentPos = getMapPixelCoords(active.currentX, active.currentY);
                checkTileAffects(ap, active.currentX, active.currentY);
            }
        } else if (keycode == Keys.LEFT) {
            if (preMove(active, Direction.WEST)) {
                active.currentX--;
                active.currentPos = getMapPixelCoords(active.currentX, active.currentY);
                checkTileAffects(ap, active.currentX, active.currentY);
            }
        } else if (keycode == Keys.A) {
            log("Attack: ");
            Gdx.input.setInputProcessor(sip);
            sip.setinitialKeyCode(keycode, combatMap, active.currentX, active.currentY);
            return false;
        } else if (keycode == Keys.C) {
            log("Cast Spell (A-Z): ");
            Gdx.input.setInputProcessor(new SpellInputProcessor(this, context, stage, active.currentX, active.currentY, ap));
            return false;
        } else if (keycode == Keys.U) {
            Tile tile = combatMap.getTile(active.currentX, active.currentY);
            if (// altar
            tile.getIndex() == 74 || (party.getSaveGame().items & Item.RAGE_GOD.getLoc()) > 0 || (party.getSaveGame().items & Item.MASK_MINAX.getLoc()) > 0) {
                // altar or rage of god
                log("Use which item: ");
                log("");
                Gdx.input.setInputProcessor(sip);
                sip.setinitialKeyCode(keycode, combatMap, active.currentX, active.currentY);
                return false;
            } else {
                log("Nothing to use!");
            }
        } else if (keycode == Keys.R) {
            Gdx.input.setInputProcessor(new ReadyWearInputAdapter(ap, true));
            return false;
        } else if (keycode == Keys.W) {
            Gdx.input.setInputProcessor(new ReadyWearInputAdapter(ap, false));
            return false;
        } else if (keycode == Keys.G) {
            getChest(party.getActivePlayer(), active.currentX, active.currentY);
            return false;
        } else if (keycode == Keys.Z) {
            showZstats = showZstats + 1;
            if (showZstats >= STATS_PLAYER1 && showZstats <= STATS_PLAYER8) {
                if (showZstats > party.getMembers().size()) {
                    showZstats = STATS_WEAPONS;
                }
            }
            if (showZstats > STATS_SPELLS) {
                showZstats = STATS_NONE;
            }
            return false;
        }
        finishPlayerTurn();
    } catch (PartyDeathException e) {
        this.returnScreen.partyDeath();
    }
    return false;
}
Also used : Creature(objects.Creature) PartyMember(objects.Party.PartyMember) Tile(objects.Tile) StaticTiledMapTile(com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile) TiledMapTile(com.badlogic.gdx.maps.tiled.TiledMapTile) PartyDeathException(util.PartyDeathException)

Example 2 with PartyDeathException

use of util.PartyDeathException in project ultimate-java by pantinor.

the class CombatScreen method getChest.

// for dungeon room chests only
public void getChest(int index, int x, int y) {
    try {
        Tile tile = combatMap.getTile(x, y);
        if (tile != null && tile.getIndex() == 60) {
            PartyMember pm = context.getParty().getMember(index);
            context.getChestTrapHandler(pm);
            log(String.format("The Chest Holds: %d Gold", context.getParty().getChestGold()));
            replaceTile("dungeon_floor", x, y);
        } else {
            log("Not Here!");
        }
    } catch (PartyDeathException e) {
        this.returnScreen.partyDeath();
    }
}
Also used : PartyMember(objects.Party.PartyMember) Tile(objects.Tile) StaticTiledMapTile(com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile) TiledMapTile(com.badlogic.gdx.maps.tiled.TiledMapTile) PartyDeathException(util.PartyDeathException)

Example 3 with PartyDeathException

use of util.PartyDeathException in project ultimate-java by pantinor.

the class DungeonScreen method dungeonTouchOrb.

public void dungeonTouchOrb(int index) {
    if (index >= context.getParty().getMembers().size()) {
        return;
    }
    PartyMember pm = context.getParty().getMember(index);
    int x = (Math.round(currentPos.x) - 1);
    int y = (Math.round(currentPos.z) - 1);
    int stats = 0;
    int damage = 0;
    switch(dngMap) {
        case DECEIT:
            stats = STATSBONUS_INT;
            break;
        case DESPISE:
            stats = STATSBONUS_DEX;
            break;
        case DESTARD:
            stats = STATSBONUS_STR;
            break;
        case WRONG:
            stats = STATSBONUS_INT | STATSBONUS_DEX;
            break;
        case COVETOUS:
            stats = STATSBONUS_DEX | STATSBONUS_STR;
            break;
        case SHAME:
            stats = STATSBONUS_INT | STATSBONUS_STR;
            break;
        case HYTHLOTH:
            stats = STATSBONUS_INT | STATSBONUS_DEX | STATSBONUS_STR;
            break;
        default:
            break;
    }
    if ((stats & STATSBONUS_STR) > 0) {
        log("Strength + 5");
        int n = Utils.adjustValueMax(pm.getPlayer().str, 5, 50);
        pm.getPlayer().str = n;
        damage += 200;
    }
    if ((stats & STATSBONUS_DEX) > 0) {
        log("Dexterity + 5");
        int n = Utils.adjustValueMax(pm.getPlayer().dex, 5, 50);
        pm.getPlayer().dex = n;
        damage += 200;
    }
    if ((stats & STATSBONUS_INT) > 0) {
        log("Intelligence + 5");
        int n = Utils.adjustValueMax(pm.getPlayer().intel, 5, 50);
        pm.getPlayer().intel = n;
        damage += 200;
    }
    Sounds.play(Sound.LIGHTNING);
    try {
        pm.applyDamage(damage, false);
    } catch (PartyDeathException pde) {
        partyDeath();
        return;
    }
    // remove orb model instance
    DungeonTileModelInstance orb = null;
    for (DungeonTileModelInstance dmi : modelInstances) {
        if (dmi.getTile() == DungeonTile.ORB) {
            if (dmi.x == x && dmi.y == y && dmi.getLevel() == currentLevel) {
                orb = dmi;
                break;
            }
        }
    }
    modelInstances.remove(orb);
    dungeonTiles[currentLevel][x][y] = DungeonTile.NOTHING;
}
Also used : PartyMember(objects.Party.PartyMember) DungeonTileModelInstance(util.DungeonTileModelInstance) PartyDeathException(util.PartyDeathException)

Example 4 with PartyDeathException

use of util.PartyDeathException in project ultimate-java by pantinor.

the class GameScreen method getChest.

public void getChest(int index, int x, int y) {
    if (context.getParty().isFlying()) {
        log("Not in a ballon!");
        return;
    }
    boolean found = false;
    Drawable chest = null;
    Array<Actor> as = mapObjectsStage.getActors();
    for (Actor a : as) {
        if (a instanceof Drawable) {
            Drawable d = (Drawable) a;
            if (StringUtils.equals("chest", d.getTile().getName()) && d.getCx() == x && d.getCy() == y) {
                chest = (Drawable) a;
                found = true;
                chest.remove();
                break;
            }
        }
    }
    if (chest == null) {
        // check tile too, ie in cities
        Tile tile = context.getCurrentMap().getTile(x, y);
        if (tile.getRule() == TileRule.chest) {
            replaceTile("brick_floor", x, y);
            found = true;
        }
    }
    try {
        if (found) {
            PartyMember pm = context.getParty().getMember(index);
            if (pm == null) {
                System.err.println("member is null " + index);
            }
            if (pm.getPlayer() == null) {
                System.err.println("player is null " + index);
            }
            context.getChestTrapHandler(pm);
            log(String.format("The Chest Holds: %d Gold", context.getParty().getChestGold()));
            if (context.getCurrentMap().getType() == MapType.city) {
                context.getParty().adjustKarma(KarmaAction.STOLE_CHEST);
            }
        } else {
            log("Not Here!");
        }
    } catch (PartyDeathException e) {
        partyDeath();
    }
}
Also used : PartyMember(objects.Party.PartyMember) Actor(com.badlogic.gdx.scenes.scene2d.Actor) Drawable(objects.Drawable) StaticTiledMapTile(com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile) TiledMapTile(com.badlogic.gdx.maps.tiled.TiledMapTile) Tile(objects.Tile) PartyDeathException(util.PartyDeathException)

Example 5 with PartyDeathException

use of util.PartyDeathException in project ultimate-java by pantinor.

the class StaticGeneratedDungeonScreen method dungeonDrinkFountain.

public void dungeonDrinkFountain(DungeonTile type, int index) {
    try {
        if (index >= context.getParty().getMembers().size()) {
            return;
        }
        PartyMember pm = context.getParty().getMember(index);
        switch(type) {
            case FOUNTAIN_PLAIN:
                log("Hmmm--No Effect!");
                break;
            case FOUNTAIN_HEAL:
                if (pm.heal(HealType.FULLHEAL)) {
                    Sounds.play(Sound.HEALING);
                    log("Ahh-Refreshing!");
                } else {
                    log("Hmmm--No Effect!");
                }
                break;
            case FOUNTAIN_ACID:
                pm.applyDamage(100, false);
                Sounds.play(Sound.DAMAGE_EFFECT);
                log("Bleck--Nasty!");
                break;
            case FOUNTAIN_CURE:
                if (pm.heal(HealType.CURE)) {
                    Sounds.play(Sound.HEALING);
                    log("Hmmm--Delicious!");
                } else {
                    log("Hmmm--No Effect!");
                }
                break;
            case FOUNTAIN_POISON:
                if (pm.getPlayer().status != StatusType.POISONED) {
                    Sounds.play(Sound.DAMAGE_EFFECT);
                    pm.applyEffect(TileEffect.POISON);
                    pm.applyDamage(100, false);
                    log("Argh-Choke-Gasp!");
                } else {
                    log("Hmm--No Effect!");
                }
                break;
        }
    } catch (PartyDeathException pde) {
        partyDeath();
    }
}
Also used : PartyMember(objects.Party.PartyMember) PartyDeathException(util.PartyDeathException)

Aggregations

PartyDeathException (util.PartyDeathException)12 PartyMember (objects.Party.PartyMember)9 DungeonTileModelInstance (util.DungeonTileModelInstance)5 TiledMapTile (com.badlogic.gdx.maps.tiled.TiledMapTile)3 StaticTiledMapTile (com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile)3 Tile (objects.Tile)3 Vector3 (com.badlogic.gdx.math.Vector3)2 Creature (objects.Creature)2 ModelInstance (com.badlogic.gdx.graphics.g3d.ModelInstance)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 SequenceAction (com.badlogic.gdx.scenes.scene2d.actions.SequenceAction)1 Drawable (objects.Drawable)1 Portal (objects.Portal)1 MixtureScreen (ultima.MixtureScreen)1 SpellInputProcessor (ultima.SpellInputProcessor)1