use of Minions.Minion in project cardgame1 by joey101937.
the class VolcanoCard method cast.
/**
* deals damage to target minion.
* @param target
* @return 1 if success, 0 if too expensive, -1 if opponent has no minions
*/
@Override
public int cast(Minion t) {
if (owner.opponent.minions.numOccupants() == 0)
return -1;
// reutrn 0 if unaffordable
if (!canAfford())
return 0;
for (Minion target : owner.opponent.minions.getOccupants()) {
Sticker impactEffect = new Sticker(SpriteHandler.blastEffectSmall, target, AI.AI.speed / 3);
}
// first put the fire sticker on all targets, then apply damage. easier to follow this way.
Main.wait(AI.AI.speed / 3);
for (Minion target : owner.opponent.minions.getOccupants()) {
target.takeDamage(spellDamage);
}
owner.resource -= cost;
owner.hand.remove(this);
TrapListener.onPlay(this);
return 1;
}
use of Minions.Minion in project cardgame1 by joey101937.
the class FrostDragonMinion method onSummon.
@Override
public void onSummon() {
Sticker s = new Sticker(SpriteHandler.snowflakeLarge, this.getXCordinate() + Minion.WIDTH / 2, this.getYcoordinate() + Minion.HEIGHT / 2, AI.AI.speed);
Main.wait(AI.AI.speed);
for (Minion m : owner.opponent.minions.getOccupants()) {
m.freeze();
}
}
use of Minions.Minion in project cardgame1 by joey101937.
the class PirranahMinion method onTurnEnd.
@Override
public void onTurnEnd() {
if (isSilenced)
return;
if (isFrozen || owner.opponent.minions.numOccupants() == 0) {
// do not attack if frozen
isFrozen = false;
return;
}
Sticker s = new Sticker(SpriteHandler.bloodMedium, this, AI.AI.speed / 2);
Main.wait(AI.AI.speed / 2);
int roll = (int) (Math.random() * (owner.opponent.minions.numOccupants()));
Minion target = owner.opponent.minions.getOccupants().get(roll);
this.refresh();
this.attack(target);
Main.wait(AI.AI.speed / 2);
}
use of Minions.Minion in project cardgame1 by joey101937.
the class BaitfishMinion method onDeath.
@Override
public void onDeath() {
Sticker s = new Sticker(SpriteHandler.skullMedium, this, 600);
if (isSilenced)
return;
ArrayList<Minion> targets = new ArrayList<>();
for (Minion m : owner.minions.getOccupants()) {
if (m.tribe == Tribe.Fish && m != this)
targets.add(m);
}
if (targets.isEmpty()) {
System.out.println("no targets for baitfish death effect");
owner.draw(new BaitfishCard());
return;
}
Minion target = targets.get(Main.generateRandom(0, targets.size()));
target.attack += 1;
target.health += 1;
target.proc();
owner.draw(new BaitfishCard());
}
use of Minions.Minion in project cardgame1 by joey101937.
the class AI method tradeOnBoard.
/**
* makes favorable trades on the board until there are no more favorable trades
* @param should we wait between making plays so the player can see whats going on?
* @param h
*/
private static void tradeOnBoard(Hero h, boolean instant) {
int damagePotential = 0;
Hero enemy;
if (h == Board.topHero)
enemy = Board.botHero;
else
enemy = Board.topHero;
for (Minion m : h.minions.getStorage()) {
if (m == null || !m.canAttack())
continue;
damagePotential += m.attack;
}
if (damagePotential >= enemy.health) {
for (Minion m : h.minions.getStorage()) {
if (m == null)
continue;
if (!instant)
Main.wait(speed);
m.attack(enemy);
}
}
boolean doneTrading = false;
while (!doneTrading) {
doneTrading = true;
for (Minion m : h.minions.getStorage()) {
if (m == null)
continue;
if (AI.canFavorablyTrade(m) && m.canAttack() && m.attack > 0) {
if (!instant)
Main.wait(speed);
m.attack(AI.getBestTarget(m));
doneTrading = false;
}
}
}
if (h == Board.topHero) {
if (Board.botHero.minions.numOccupants() == 0) {
for (Minion m : h.minions.getStorage()) {
if (m == null || !m.canAttack())
continue;
if (!instant)
Main.wait(speed);
m.attack(Board.botHero);
}
}
} else {
// we are playing as bothero
if (Board.topHero.minions.numOccupants() == 0) {
for (Minion m : h.minions.getStorage()) {
if (m == null || !m.canAttack())
continue;
if (!instant)
Main.wait(speed);
m.attack(Board.topHero);
}
}
}
}
Aggregations