Coverage Summary for Class: FortressType (com.mozarellabytes.kroy.Entities)

Class Class, % Method, % Line, %
FortressType 100% (1/ 1) 81.8% (9/ 11) 90.9% (20/ 22)


1 package com.mozarellabytes.kroy.Entities; 2  3 import com.badlogic.gdx.Gdx; 4 import com.badlogic.gdx.graphics.Texture; 5  6 /** 7  * FortressType is an enum defining the fortresses that can be present in the game. 8  * Each fortress type has a unique name, delay between firing bombs, attack range, 9  * maximum health points, attack points, width, height and sprite. 10  * This allows there to be numerous different types of fortresses without having 11  * to randomly generate values which may make the game unplayable in some instances 12  * and too easy in other instances. 13  */ 14  15 public enum FortressType { 16  17  /** The preset values for the different fortress types includes the type's: 18  * name, delay between firing bombs, attack range, maximum health points, 19  * attack points, width, height and sprite. 20  */ 21  Revs ("Revolution", 2500, 7, 100, 10, 5, 3, new Texture(Gdx.files.internal("sprites/fortress/fortress_revs.png"))), 22  Walmgate ("Walmgate Bar", 1500, 8, 200, 15, 5, 5, new Texture(Gdx.files.internal("sprites/fortress/fortress_walmgate.png"))), 23  Clifford ("Clifford's Tower", 500, 4, 150, 20, 4, 3, new Texture(Gdx.files.internal("sprites/fortress/fortress_clifford.png"))); 24  25  /** The name for the fortress, visible once the fortress has been clicked on */ 26  private final String name; 27  28  /** The time between firing bombs */ 29  private final int delay; 30  31  /** The range that the fortress can see and attack firetrucks */ 32  private final float range; 33  34  /** The maximum health points for the fortress - always 100 */ 35  private final float maxHP; 36  37  /** Attack points - how much damage the fortress can inflict */ 38  private final float AP; 39  40  /** The width of the sprite measured in tiles */ 41  private final int w; 42  43  /** The height of the sprite measured in tiles */ 44  private final int h; 45  46  /** The sprite for the fortress */ 47  private final Texture texture; 48  49  /** 50  * Constructs the FortressType 51  * 52  * @param name The name for this type of fortress 53  * @param delay The delay between firing bombs in milliseconds 54  * @param range The attack range for this type of fortress in tiles 55  * @param maxHP The maximum health points for this type of fortress 56  * @param AP The attack points for this type of fortress 57  * @param w The width of the sprite for this type of fortress in tiles 58  * @param h The height of the sprite for this type of fortress in tiles 59  * @param texture The sprite for this type of fortress 60  * 61  */ 62  FortressType(String name, int delay, float range, float maxHP, float AP, int w, int h, Texture texture) { 63  this.name = name; 64  this.delay = delay; 65  this.range = range; 66  this.maxHP = maxHP; 67  this.AP = AP; 68  this.w = w; 69  this.h = h; 70  this.texture = texture; 71  } 72  73  public String getName() { return name; } 74  75  public int getDelay() { return delay; } 76  77  public float getRange() { return range; } 78  79  public float getMaxHP() { return maxHP; } 80  81  public float getAP() { return AP; } 82  83  public int getW() { return w; } 84  85  public int getH() { return h; } 86  87  public Texture getTexture() { return texture; } 88  89 }