use of Minions.Minion in project cardgame1 by joey101937.
the class Hero method onTurnEnd.
public void onTurnEnd() {
if (Board.playerHero == this)
InputHandler.enabled = false;
ArrayList<Minion> done = new ArrayList<>();
while (true) {
try {
for (Minion m : minions.getStorage()) {
if (m != null && !done.contains(m)) {
m.onTurnEnd();
done.add(m);
}
}
break;
} catch (ConcurrentModificationException cme) {
System.out.println("cme at hero 134");
}
}
this.turn = false;
}
use of Minions.Minion in project cardgame1 by joey101937.
the class InputHandler method mouseReleased.
@Override
public void mouseReleased(MouseEvent e) {
if (!Board.playerHero.turn || !enabled)
return;
Minion target = getMinionAt(e.getX() / Board.xScale, e.getY() / Board.yScale);
Hero targetH = getHeroAt(e.getX() / Board.xScale, e.getY() / Board.yScale);
if (target != null && selectedMinion != null && selectedMinion.owner != target.owner) {
// Minion attacking minion
selectedMinion.attack(target);
}
if (targetH != null && selectedMinion != null && selectedMinion.owner != targetH) {
// Minion attacking hero
selectedMinion.attack(targetH);
}
if (target != null && selectedCard != null && selectedCard.isTargeted) {
// card cast with minion target
selectedCard.cast(target);
}
if (targetH != null && selectedCard != null && selectedCard.isTargeted) {
selectedCard.castOnHero(targetH);
}
selectedMinion = null;
selectedCard = null;
}
use of Minions.Minion in project cardgame1 by joey101937.
the class VisualEffectHandler method drawLineM.
/**
* draws line from selected minion to location of the mouse
* @param g
*/
public void drawLineM(Graphics2D g) {
Minion selected = InputHandler.selectedMinion;
if (selected == null)
return;
g.drawLine(selected.getXCordinate() + Minion.WIDTH / 2, selected.getYcoordinate() + Minion.HEIGHT / 2, Board.mouseX, Board.mouseY);
}
use of Minions.Minion in project cardgame1 by joey101937.
the class CarnifishMinion method onSummon.
@Override
public void onSummon() {
for (Minion m : owner.minions.getOccupants()) {
if (m.name.equals("Baitfish")) {
Sticker s = new Sticker(SpriteHandler.bloodMedium, this, AI.AI.speed);
Main.wait(AI.AI.speed);
m.destroy();
}
}
}
use of Minions.Minion in project cardgame1 by joey101937.
the class SeaSerpentMinion method onSummon.
@Override
public void onSummon() {
Sticker s = new Sticker(SpriteHandler.bloodMedium, this, AI.AI.speed / 2);
Main.wait(AI.AI.speed / 2);
for (Minion m : owner.minions.getOccupants()) {
if (m.tribe != Tribe.Fish) {
m.takeDamage(1);
}
}
for (Minion m : owner.opponent.minions.getOccupants()) {
if (m.tribe != Tribe.Fish) {
m.takeDamage(1);
}
}
}
Aggregations