Search in sources :

Example 11 with PartyMember

use of objects.Party.PartyMember in project ultimate-java by pantinor.

the class GameScreen method useSkull.

/**
 * Use skull on the entrance to the Abyss
 */
public void useSkull() {
    if ((context.getParty().getSaveGame().items & Item.SKULL.getLoc()) == 0) {
        log("None owned!");
        return;
    }
    if ((context.getParty().getSaveGame().items & Item.SKULL_DESTROYED.getLoc()) > 0) {
        log("None owned!");
        return;
    }
    if (context.getCurrentMap().getId() != Maps.WORLD.getId()) {
        log("Hmm...No effect!");
        return;
    }
    Vector3 v = getCurrentMapCoords();
    int x = (int) v.x;
    int y = (int) v.y;
    if (x == 0xe9 && y == 0xe9) {
        log("You cast the Skull of Mondain into the Abyss!");
        context.getParty().getSaveGame().items = (context.getParty().getSaveGame().items & ~Item.SKULL.getLoc()) | Item.SKULL_DESTROYED.getLoc();
        context.getParty().adjustKarma(KarmaAction.DESTROYED_SKULL);
    } else {
        log("You hold the evil Skull of Mondain the Wizard aloft...");
        PartyMember user = context.getParty().getMember(0);
        SpellUtil.destoryAllCreatures(this, user);
        context.getParty().adjustKarma(KarmaAction.USED_SKULL);
    }
}
Also used : PartyMember(objects.Party.PartyMember) Vector3(com.badlogic.gdx.math.Vector3)

Example 12 with PartyMember

use of objects.Party.PartyMember 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 13 with PartyMember

use of objects.Party.PartyMember 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)

Example 14 with PartyMember

use of objects.Party.PartyMember in project ultimate-java by pantinor.

the class StaticGeneratedDungeonScreen method getChest.

public void getChest(int index, int x, int y) {
    try {
        DungeonTileModelInstance chest = null;
        for (DungeonTileModelInstance dmi : modelInstances) {
            if (dmi.getTile() == DungeonTile.CHEST) {
                if (dmi.x == x && dmi.y == y && dmi.getLevel() == currentLevel) {
                    chest = dmi;
                    break;
                }
            }
        }
        if (chest != null) {
            PartyMember pm = context.getParty().getMember(index);
            context.getChestTrapHandler(pm);
            log(String.format("The Chest Holds: %d Gold", context.getParty().getChestGold()));
            // remove chest model instance
            modelInstances.remove(chest);
            dungeonTiles[currentLevel][x][y] = DungeonTile.NOTHING;
        } else {
            log("Not Here!");
        }
    } catch (PartyDeathException e) {
        partyDeath();
    }
}
Also used : DungeonTileModelInstance(util.DungeonTileModelInstance) PartyMember(objects.Party.PartyMember) PartyDeathException(util.PartyDeathException)

Example 15 with PartyMember

use of objects.Party.PartyMember in project ultimate-java by pantinor.

the class StaticGeneratedDungeonScreen method dungeonTouchOrb.

public void dungeonTouchOrb(int index) {
    try {
        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;
        if (dngMap == Maps.DELVE_SORROWS) {
            if (currentLevel == 1) {
                stats = STATSBONUS_INT | STATSBONUS_DEX;
            } else {
                stats = STATSBONUS_INT | STATSBONUS_DEX | STATSBONUS_STR;
            }
        } else {
            stats = STATSBONUS_STR;
        }
        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);
        pm.applyDamage(damage, false);
        // 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;
    } catch (PartyDeathException pde) {
        partyDeath();
    }
}
Also used : PartyMember(objects.Party.PartyMember) DungeonTileModelInstance(util.DungeonTileModelInstance) PartyDeathException(util.PartyDeathException)

Aggregations

PartyMember (objects.Party.PartyMember)24 PartyDeathException (util.PartyDeathException)9 Creature (objects.Creature)5 Tile (objects.Tile)5 TiledMapTile (com.badlogic.gdx.maps.tiled.TiledMapTile)4 StaticTiledMapTile (com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile)4 DungeonTileModelInstance (util.DungeonTileModelInstance)4 SequenceAction (com.badlogic.gdx.scenes.scene2d.actions.SequenceAction)3 Color (com.badlogic.gdx.graphics.Color)2 Vector3 (com.badlogic.gdx.math.Vector3)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 Person (objects.Person)2 InputMultiplexer (com.badlogic.gdx.InputMultiplexer)1 GlyphLayout (com.badlogic.gdx.graphics.g2d.GlyphLayout)1 TiledMap (com.badlogic.gdx.maps.tiled.TiledMap)1 Action (com.badlogic.gdx.scenes.scene2d.Action)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)1 TextFieldListener (com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener)1