-
Notifications
You must be signed in to change notification settings - Fork 0
/
levelup.php
105 lines (80 loc) · 2.27 KB
/
levelup.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
include_once("statics.php");
include_once("class_definitions.php");
include_once("personas.php");
class LevelUp {
public $commands = [];
}
$levelUp = new LevelUp();
function getStatEquivalent($statName) {
$outString = "";
switch ( $statName ) {
case "precision": {
$outString = "hit chance";
}
break;
case "endurance": {
$outString = "HP";
}
break;
case "reflexes": {
$outString = "dodge chance";
}
break;
case "strength": {
$outString = "attack damage";
}
break;
case "oddness": {
$outString = "MP";
}
break;
case "nerve": {
$outString = "defense";
}
break;
case "acuity": {
$outString = "crit chance";
}
break;
default:
break;
}
return $outString;
}
function consumeStatIncrease($charData, $statName) {
$charData->{$statName}++;
$statEquivalent = getStatEquivalent($statName);
echo "Your $statName increases, improving your $statEquivalent. You go back to Adventuring.\n";
StateManager::ChangeState($charData, GameStates::Adventuring);
}
$levelUp->commands[] = new InputFragment("precision", function($charData, $mapData) {
consumeStatIncrease($charData, "precision");
});
$levelUp->commands[] = new InputFragment("endurance", function($charData, $mapData) {
// Increase HP.
$charData->hp += PersonaMultiplier::Endurance;
$charData->hpMax += PersonaMultiplier::Endurance;
consumeStatIncrease($charData, "endurance");
});
$levelUp->commands[] = new InputFragment("reflexes", function($charData, $mapData) {
consumeStatIncrease($charData, "reflexes");
});
$levelUp->commands[] = new InputFragment("strength", function($charData, $mapData) {
consumeStatIncrease($charData, "strength");
});
$levelUp->commands[] = new InputFragment("oddness", function($charData, $mapData) {
// Increase MP.
$charData->mp += PersonaMultiplier::Oddness;
$charData->mpMax += PersonaMultiplier::Oddness;
consumeStatIncrease($charData, "oddness");
});
$levelUp->commands[] = new InputFragment("nerve", function($charData, $mapData) {
consumeStatIncrease($charData, "nerve");
});
$levelUp->commands[] = new InputFragment("acuity", function($charData, $mapData) {
consumeStatIncrease($charData, "acuity");
});
// Add unique identifiers to commands.
$allocator = new UIDAllocator($levelUp->commands);
$allocator->Allocate();