-
Notifications
You must be signed in to change notification settings - Fork 0
/
Monster.php
39 lines (33 loc) · 930 Bytes
/
Monster.php
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
<?php
class Monster{
public $name;
public $react;
public $deflect;
public $soak;
public $hp;
public $current_hp;
public $attack_name;
public $attack_target;
public $attack_damage;
function __construct($monster){
$this->name = $monster['name'];
$this->react = $monster['react'];
$this->deflect = $monster['deflect'];
$this->soak = $monster['soak'];
$this->hp = $monster['hp'];
$this->current_hp = $this->hp;
$this->attack_name = $monster['attack_name'];
$this->attack_target = $monster['attack_target'];
$this->attack_damage = $monster['attack_damage'];
}
function takeDamage($damage){
if($damage-$this->soak > 0){
$this->current_hp -= $damage;
}else{
$this->current_hp--;
}
}
function reset(){
$this->current_hp = $this->hp;
}
}