Add type damage multipliers

master
Skylar Ittner 8 years ago
parent 30dacbd85c
commit e3dd24565b

@ -16,8 +16,9 @@ if ($place['teamid'] == $user['teamid']) {
}
// The underwhelming damage formulas :P
require_once 'type_grid.php';
$userdrain = 5 * floor($user['level']);
$damage = 2 * $userdrain;
$damage = 2 * $userdrain * $TYPE_GRID[$user['teamid']][$place['teamid']];
// Check if action possible
if ($user['energy'] < $userdrain) {
@ -47,4 +48,4 @@ if ($placehp == 0) {
$database->update('locations', ['currentlife' => $placehp], ['locationid' => $VARS['locationid']]);
}
sendOK("Success!");
sendOK("Success!");

@ -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]
];