forked from TechHead27/EW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Skeleton.java
53 lines (47 loc) · 1.15 KB
/
Skeleton.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
50
51
52
53
import greenfoot.*;
/**
* Write a description of class Zombie here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Skeleton extends Monster
{
public Skeleton()
{
super();
GreenfootImage skeleton = new GreenfootImage("images/monsters/skeleton.png");
skeleton.scale(50, 90);
setImage(skeleton);
health = 30;
strength = 7;
defense = 8;
piety = 3;
will = 5;
speed = 4;
}
/**
* Attack with a physical attack
* @return the amount of damage dealt
*/
public int attack(Character player)
{
int damage = 0;
int playDef = player.getDefense();
damage = (strength * 2) / (playDef * 3);
if (damage == 0) damage = 1;
return damage;
}
/**
* Attack with a magical attack
* @return the amount of damage dealt
*/
public int cast(Character player)
{
int damage = 0;
int playMDef = player.getWill();
damage = (piety * 2) / playMDef;
if (damage == 0) damage = 1;
return damage;
}
}