- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathYellowWolf.java
More file actions
Latest commit
62 lines (55 loc) · 1.39 KB
/
Copy pathYellowWolf.java
File metadata and controls
62 lines (55 loc) · 1.39 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
importgreenfoot.*;
/**
* Write a description of class YellowWolf here.
*
* @author (your name)
* @version (a version number or a date)
*/
publicclassYellowWolfextendsWolf
{
publicYellowWolf()
{
super();
GreenfootImagewolf = newGreenfootImage("images/monsters/wolf_yellow.png");
wolf.scale(100, 100);
setImage(wolf);
health = 35;
strength = 3;
defense = 4;
piety = 4;
will = 10;
speed = 11;
}
/**
* Attack with a physical attack
* @return the amount of damage dealt
*/
publicintattack(Characterplayer)
{
intdamage = 0;
intplayDef = player.getDefense();
damage = (strength * 3) / (playDef * 2);
if (damage == 0) damage = 1;
returndamage;
}
/**
* Attack with a magical attack
* @return the amount of damage dealt
*/
publicintcast(Characterplayer)
{
intdamage = 0;
intplayMDef = player.getWill();
damage = (piety * 2) / (playMDef * 3);
if (damage == 0) damage = 1;
returndamage;
}
/**
* Act - do whatever the YellowWolf wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
publicvoidact()
{
// Add your action code here.
}
}