-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathStudent.java
49 lines (34 loc) · 1.26 KB
/
Student.java
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
/*=============================================
Student, houses the default attacks that will be used if individuals choose not to specialize
=============================================*/
public abstract class Student extends Character {
// ~~~~~~~~~~~ INSTANCE VARIABLES ~~~~~~~~~~~
protected String _name;
public String getName(){
return _name;
}
public int attackNormal( Character opponent ) {
int type = (int)(Math.random()*2);
int damage = 0;
if (type == 0){
System.out.println(_name+" asks annoying question!");
damage = askQuestion(opponent);}
else {
System.out.println(_name + " does his homework using code found online!");
damage = doHW(opponent);}
if ( damage < 0 )
damage = 0;
opponent.lowerHP( damage );
return damage;}
public int askQuestion(Character opponent){
int damage = (int)( (_strength * _attack) - opponent.getDefense() );
return damage;
}
public int doHW(Character opponent){
int damage = (int)( (_strength * _attack) - opponent.getDefense() );
damage *= 1.3;
return damage;
}
public String about(){
return "The Student is a persistant fellow, working against great odds in the hope of one day not being a Student";}
}//end class Warrior