Coverage Summary for Class: KillQuest (com.mygdx.game.Quests)
Class |
Class, %
|
Method, %
|
Line, %
|
KillQuest |
100%
(1/1)
|
100%
(5/5)
|
100%
(14/14)
|
1 package com.mygdx.game.Quests;
2
3 import com.mygdx.game.Components.Pirate;
4 import com.mygdx.game.Entitys.Entity;
5 import com.mygdx.game.Entitys.Indicator;
6 import com.mygdx.game.Entitys.Player;
7
8 /**
9 * A Quest to kill a college is only complete once that college is dead
10 */
11 public class KillQuest extends Quest {
12 private Pirate target;
13
14 /**
15 * Creates a Kill Quest, with all the base attributes filled in with templates
16 */
17 public KillQuest() {
18 super();
19 name = "Kill the college";
20 description = "KILL KILL KILL";
21 plunderReward = 100;
22 pointReward = 200;
23 target = null;
24 }
25
26 /**
27 * Creates a Kill Quest
28 * @param target The Pirate which needs to be defeated for the quest
29 */
30 public KillQuest(Pirate target) {
31 this();
32 this.target = target;
33 description = target.getFaction().getName();
34 new Indicator(this);
35 }
36
37 /**
38 * Creates a Kill Quest
39 * @param target The Entity which needs to be defeated for the quest
40 */
41 public KillQuest(Entity target) {
42 this(target.getComponent(Pirate.class));
43 }
44
45 /**
46 * @return The completion status of the quest
47 */
48 @Override
49 public boolean checkCompleted(Player p) {
50 isCompleted = !target.isAlive();
51 return isCompleted;
52 }
53
54 /**
55 * Added for Assessment 2
56 * @return the target of this quest
57 */
58 public Pirate getTarget() {
59 return target;
60 }
61 }