Add terrain and weather damage multipliers
This commit is contained in:
parent
b02acb4c18
commit
90eacf34cd
@ -22,7 +22,33 @@ $type_mod = $TYPE_GRID[$user['teamid']][$place['teamid']];
|
||||
if ($type_mod == 0.5) {
|
||||
$type_mod = 0.8;
|
||||
}
|
||||
$damage = pow(floor($user['level']), 0.5) * 4 * $type_mod;
|
||||
|
||||
$terrain_mod = 1.0;
|
||||
$weather_mod = 1.0;
|
||||
if (!is_empty($VARS['lat']) && !is_empty($VARS['long'])) {
|
||||
require 'weather_inc.php';
|
||||
$terrain = json_decode(file_get_contents("http://gis.terranquest.net/terrain.php?key=" . GIS_API_KEY . "&lat=" . $VARS['lat'] . "&long=" . $VARS['long']), TRUE);
|
||||
if ($terrain['status'] == 'OK') {
|
||||
$terraintype = $terrain['type'];
|
||||
$terrain_mod = $TERRAIN_GRID[$terraintype][$user['teamid'] - 1];
|
||||
if ($terrain_mod == 0.5) {
|
||||
$terrain_mod = .9;
|
||||
} else if ($terrain_mod == 2) {
|
||||
$terrain_mod = 1.1;
|
||||
} else if ($terrain_mod == 3) {
|
||||
$terrain_mod = 1.3;
|
||||
}
|
||||
}
|
||||
$weather_icon = $currently['icon'];
|
||||
$weather_mod = $WEATHER_GRID[$weather_icon][$user['teamid'] - 1];
|
||||
if ($weather_mod == 0.5) {
|
||||
$weather_mod = .9;
|
||||
} else if ($weather_mod == 2) {
|
||||
$weather_mod = 1.1;
|
||||
}
|
||||
}
|
||||
|
||||
$damage = pow(floor($user['level']), 0.5) * 4 * $type_mod * $terrain_mod * $weather_mod;
|
||||
//$damage = 2 * $userdrain * $TYPE_GRID[$user['teamid']][$place['teamid']];
|
||||
// Check if action possible
|
||||
if ($user['energy'] < $userdrain) {
|
||||
|
@ -14,3 +14,35 @@ $TYPE_GRID = [
|
||||
["light", 1, 1, 1, 1, 0, 2],
|
||||
["dark", 1, 0.5, 1, 2, 0.5, 0]
|
||||
];
|
||||
|
||||
$TERRAIN_GRID = [
|
||||
// Water Fire Earth Wind Light Dark
|
||||
0 => [3, 0.5, 0.5, 1, 1, 1],
|
||||
1 => [1, 1, 1, 1, 1, 2],
|
||||
2 => [1, 1, 1, 1, 1, 1],
|
||||
3 => [1, 1, 1, 1, 1, 1],
|
||||
4 => [1, 1, 1, 1, 1, 1],
|
||||
5 => [1, 1, 1, 1, 1, 1],
|
||||
6 => [1, 1, 1, 1, 1, 1],
|
||||
7 => [1, 1, 1, 1, 1, 1],
|
||||
8 => [1, 2, 1, 1, 1, 1],
|
||||
9 => [1, 2, 1, 1, 1, 1],
|
||||
10 => [1, 1, 2, 2, 2, 0.5],
|
||||
11 => [1, 1, 2, 2, 2, 0.5],
|
||||
12 => [0.5, 1, 1, 1, 1, 1],
|
||||
13 => [1, 1, 1, 0.5, 0.5, 2]
|
||||
];
|
||||
|
||||
$WEATHER_GRID = [
|
||||
// Water Fire Earth Wind Light Dark
|
||||
"rain" => [2, 0.5, 1, 1, 1, 1],
|
||||
"clear-day" => [1, 1, 1, 1, 2, 1],
|
||||
"clear-night" => [1, 1, 1, 1, 1, 2],
|
||||
"partly-cloudy-day" => [1, 1, 1, 1, 2, 1],
|
||||
"partly-cloudy-night" => [1, 1, 1, 1, 1, 2],
|
||||
"cloudy" => [1, 1, 1, 1, 1, 1],
|
||||
"sleet" => [1, 1, 1, 1, 1, 1],
|
||||
"snow" => [1, 1, 1, 1, 1, 1],
|
||||
"wind" => [1, 1, 1, 2, 1, 1],
|
||||
"fog" => [1, 1, 1, 1, 1, 1]
|
||||
];
|
||||
|
Reference in New Issue
Block a user