Search in sources :

Example 6 with Sticker

use of cardgame1.Sticker in project cardgame1 by joey101937.

the class AI method playOutHand.

/**
 * plays all cards we can in the best way possible, recursively
 */
public static void playOutHand(Hero h) {
    Board.getMainBoard().tick();
    boolean playOver = true;
    for (Card c : h.hand) {
        // there is something we want to play
        if (c.canAfford() && AI.getValueOfCard(c) > 0)
            playOver = false;
    }
    if (playOver)
        return;
    ArrayList<Card> playable = new ArrayList<>();
    for (Card c : h.hand) {
        if (c.canAfford() && getValueOfCard(c) > 0)
            playable.add(c);
    }
    // orders the cards using their comparable interface, ordering based on value rather than worth (value accounts for cost, worth does not)
    playable.sort(null);
    if (playable.get(playable.size() - 1).cardPurpose == CardPurpose.Trap) {
        // let user know we are playing a trap card
        Sticker s = new Sticker(SpriteHandler.trapPlaceholder, 1700, 200, speed * 3);
    } else {
        // let user know what non-trap card we are playing
        Sticker s = new Sticker(playable.get(playable.size() - 1), 1700, 200, speed * 3);
    }
    Main.wait(speed * 3);
    System.out.println("attempting to play: " + playable.get(playable.size() - 1));
    AI.playCard(playable.get(playable.size() - 1));
    playOutHand(h);
}
Also used : Sticker(cardgame1.Sticker) ArrayList(java.util.ArrayList) Card(Cards.Card)

Example 7 with Sticker

use of cardgame1.Sticker in project cardgame1 by joey101937.

the class ArcherCard method cast.

@Override
public int cast(Minion target) {
    int outcome = defaultMinionSummon();
    if (outcome == 1) {
        Sticker s = new Sticker(SpriteHandler.slashEffect, target, AI.AI.speed / 3);
        Main.wait(AI.AI.speed / 3);
        target.takeDamage(summonDamage);
    }
    return outcome;
}
Also used : Sticker(cardgame1.Sticker)

Example 8 with Sticker

use of cardgame1.Sticker in project cardgame1 by joey101937.

the class ArcherCard method castOnHero.

@Override
public int castOnHero(Hero target) {
    int outcome = defaultMinionSummon();
    if (outcome == 1) {
        Sticker s = new Sticker(SpriteHandler.slashEffect, target, AI.AI.speed / 3);
        Main.wait(AI.AI.speed / 3);
        target.takeDamage(summonDamage);
    }
    return outcome;
}
Also used : Sticker(cardgame1.Sticker)

Example 9 with Sticker

use of cardgame1.Sticker in project cardgame1 by joey101937.

the class FireBoltCard method cast.

/**
 * deals damage to target minion.
 * @param target
 * @return 1 if success, 0 if too expensive, -1 if null param
 */
@Override
public int cast(Minion target) {
    if (target == null)
        return -1;
    // reutrn 0 if unaffordable
    if (!canAfford())
        return 0;
    Sticker impactEffect = new Sticker(SpriteHandler.blastEffectSmall, target, AI.AI.speed / 3);
    Main.wait(AI.AI.speed / 3);
    target.takeDamage(spellDamage);
    owner.resource -= cost;
    owner.hand.remove(this);
    TrapListener.onPlay(this);
    return 1;
}
Also used : Sticker(cardgame1.Sticker)

Example 10 with Sticker

use of cardgame1.Sticker in project cardgame1 by joey101937.

the class FireBoltCard method castOnHero.

/**
 * deals damage to target hero
 * @param target
 * @return 1 if success, 0 if too expensive, -1 if null param
 */
@Override
public int castOnHero(Hero target) {
    if (target == null)
        return -1;
    // reutrn 0 if unaffordable
    if (!canAfford())
        return 0;
    Sticker impactEffect = new Sticker(SpriteHandler.blastEffectSmall, target, AI.AI.speed / 3);
    Main.wait(AI.AI.speed / 3);
    target.takeDamage(spellDamage);
    owner.resource -= cost;
    owner.hand.remove(this);
    TrapListener.onPlay(this);
    return 1;
}
Also used : Sticker(cardgame1.Sticker)

Aggregations

Sticker (cardgame1.Sticker)20 Minion (Minions.Minion)7 ArrayList (java.util.ArrayList)2 Card (Cards.Card)1 BaitfishCard (Cards.Fish.BaitfishCard)1 SeaSerpentCard (Cards.Fish.SeaSerpentCard)1 ZombieMinion (Minions.Undead.ZombieMinion)1