-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemies.java
More file actions
executable file
·135 lines (113 loc) · 2.87 KB
/
Enemies.java
File metadata and controls
executable file
·135 lines (113 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**
* This is the Enemies class;
* This is where the information about the enemies for this game is stored. These are NPC that
* you can attack and defeat using your attack command. They range from different animals to transport.
* However they are all realistic creatures, the ones that are imaginary cause no damage.
*
* @author
* @version
*/
public class Enemies
{
// instance variables - replace the example below with your own
private CommandWord commandWord;
public String name;
public int health;
private String reaction;
public int damage;
/**
* Constructor for objects of class Enemies
*/
public Enemies(String enemiesName, int enemiesHealth, String enemiesreaction, int enemiesDamage)
{
this.name = enemiesName;
this.health = enemiesHealth;
this.reaction = enemiesreaction;
this.damage = enemiesDamage;
}
/**
* An example of a method - replace this comment with your own
*
* @return String enemy name
*/
public String getName()
{
return name;
}
/**
* return int enemy health
*/
public int getHealth()
{
return health;
}
public String getReaction()
{
return reaction;
}
public int getenemiesDamage()
{
return damage;
}
/**
* param creates a new name for the enemies
*/
public void setName(String newName)
{
name = newName;
}
/**
* param this int creates the health of the enemy.
*/
public void setHealth(int newHealth)
{
health = newHealth;
}
public void setReaction(String newReaction)
{
reaction = newReaction;
}
public void setenemiesDamage(int newDamage)
{
damage = newDamage;
}
/**
* param prints out the informaton on the enemy.
*/
public void print()
{
System.out.println(name);
System.out.println(health);
System.out.println(reaction);
System.out.println(damage);
}
public void enemiesAttack()
{
System.out.println(reaction);
System.out.println(damage);
}
/**
* param What happens when the enemy's health reaches below 0
*/
public void detractHealth(int kill) //what happens when a player beat up an enemy
{
health = health - kill;
System.out.println("Enemies has " + health + " health");
if(health <= 0)
{
System.out.println ("you have beat up a " + name );
}
}
public boolean policeOfficer()
{
if(commandWord == CommandWord.ATTACK)
{
System.out.println("You have been arrested");
return true;
}
else
{
return false;
}
}
}