-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMinion.php
64 lines (56 loc) · 1.56 KB
/
Minion.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
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
<?php
class Minion extends Player
{
public function bananaStrike()
{
$chance = rand(0, 100);
if ($chance < 10) {
echo "<p style='font-style: italic; color: gold; font-weight: bold'>
Banana strike skill activated!<br></p>";
return true;
}
return false;
}
public function umbrellaShield()
{
$chance = rand(0, 100);
if ($chance < 20) {
echo "<p style='font-style: italic; color: gold; font-weight: bold'>
Umbrella shield skill activated!<br></p>";
return true;
}
return false;
}
public function setAttributes()
{
$this->health = rand(70, 100);
$this->strength = rand(70, 80);
$this->defense = rand(45, 55);
$this->speed = rand(40, 50);
$this->luck = rand(10, 30);
}
public function getAttributes()
{
return
"TIM powers:<br>" .
$this->getHealth() . " health<br>" .
$this->getDefense() . " defense<br>" .
$this->getSpeed() . " speed<br>" .
$this->getStrength() . " strength<br>" .
$this->getLuck() . "% luck<br>";
}
public function getDamage($strength)
{
$damage = $strength - $this->defense;
if ($damage < 0) return 0;
if ($this->umbrellaShield()) {
$damage /= 2;
}
if ($this->health > $damage) {
$this->health -= $damage;
} else {
$this->health = 0;
}
return $damage;
}
}