Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.List;
  2.  
  3. class Artillery extends Player {
  4.  
  5.   public Artillery(int id) {
  6.     super(id, 2,CharacterTypes.PLAYER, CharacterTypes.ARTILLERY, 5, 0.5);
  7.   }
  8.  
  9.   private void dealSplashDamage(Battlefield battlefield, int x, int y) {
  10.     List<int[]> adjacentFields = battlefield.getAdjacentFields(x, y);
  11.     int splashDamage = this.damage - 2;
  12.     for (int[] field : adjacentFields) {
  13.       super.attack(battlefield, field[0], field[1], splashDamage);
  14.     }
  15.   }
  16.  
  17.   public boolean attack(Battlefield battlefield, int x, int y) {
  18.     boolean result = false;
  19.     result = super.attack(battlefield, x, y);
  20.     this.dealSplashDamage(battlefield, x, y);
  21.     return result;
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement