Add type damage multipliers
This commit is contained in:
parent
30dacbd85c
commit
e3dd24565b
@ -16,8 +16,9 @@ if ($place['teamid'] == $user['teamid']) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The underwhelming damage formulas :P
|
// The underwhelming damage formulas :P
|
||||||
|
require_once 'type_grid.php';
|
||||||
$userdrain = 5 * floor($user['level']);
|
$userdrain = 5 * floor($user['level']);
|
||||||
$damage = 2 * $userdrain;
|
$damage = 2 * $userdrain * $TYPE_GRID[$user['teamid']][$place['teamid']];
|
||||||
|
|
||||||
// Check if action possible
|
// Check if action possible
|
||||||
if ($user['energy'] < $userdrain) {
|
if ($user['energy'] < $userdrain) {
|
||||||
@ -47,4 +48,4 @@ if ($placehp == 0) {
|
|||||||
$database->update('locations', ['currentlife' => $placehp], ['locationid' => $VARS['locationid']]);
|
$database->update('locations', ['currentlife' => $placehp], ['locationid' => $VARS['locationid']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendOK("Success!");
|
sendOK("Success!");
|
||||||
|
16
type_grid.php
Normal file
16
type_grid.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 2-dimensional array of damage multipliers.
|
||||||
|
* The first dimension is the attacking type, the second is the defending.
|
||||||
|
* Example: To find the multiplier when team 1 attacks team 2: $TYPE_GRID[1][2]
|
||||||
|
*/
|
||||||
|
$TYPE_GRID = [
|
||||||
|
["", "water", "fire", "earth", "wind", "light", "dark"],
|
||||||
|
["water", 0, 2, 0.5, 1, 1, 1],
|
||||||
|
["fire", 0.5, 0, 0.5, 0.5, 2, 1],
|
||||||
|
["earth", 2, 1, 0, 0.5, 0.5, 1],
|
||||||
|
["wind", 0.5, 0.5, 2, 0, 1, 0.5],
|
||||||
|
["light", 1, 1, 1, 1, 0, 2],
|
||||||
|
["dark", 1, 0.5, 1, 2, 0.5, 0]
|
||||||
|
];
|
Reference in New Issue
Block a user