type_grid.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * A 2-dimensional array of damage multipliers.
  4. * The first dimension is the attacking type, the second is the defending.
  5. * Example: To find the multiplier when team 1 attacks team 2: $TYPE_GRID[1][2]
  6. */
  7. $TYPE_GRID = [
  8. ["", "water", "fire", "earth", "wind", "light", "dark"],
  9. ["water", 0, 2, 0.5, 1, 1, 1],
  10. ["fire", 0.5, 0, 0.5, 0.5, 2, 1],
  11. ["earth", 2, 1, 0, 0.5, 0.5, 1],
  12. ["wind", 0.5, 0.5, 2, 0, 1, 0.5],
  13. ["light", 1, 1, 1, 1, 0, 2],
  14. ["dark", 1, 0.5, 1, 2, 0.5, 0]
  15. ];
  16. $TERRAIN_GRID = [
  17. // Water Fire Earth Wind Light Dark
  18. 0 => [3, 0.5, 0.5, 1, 1, 1],
  19. 1 => [1, 1, 1, 1, 1, 2],
  20. 2 => [1, 1, 1, 1, 1, 1],
  21. 3 => [1, 1, 1, 1, 1, 1],
  22. 4 => [1, 1, 1, 1, 1, 1],
  23. 5 => [1, 1, 1, 1, 1, 1],
  24. 6 => [1, 1, 1, 1, 1, 1],
  25. 7 => [1, 1, 1, 1, 1, 1],
  26. 8 => [1, 2, 1, 1, 1, 1],
  27. 9 => [1, 2, 1, 1, 1, 1],
  28. 10 => [1, 1, 2, 2, 2, 0.5],
  29. 11 => [1, 1, 2, 2, 2, 0.5],
  30. 12 => [0.5, 1, 1, 1, 1, 1],
  31. 13 => [1, 1, 1, 0.5, 0.5, 2]
  32. ];
  33. $WEATHER_GRID = [
  34. // Water Fire Earth Wind Light Dark
  35. "rain" => [2, 0.5, 1, 1, 1, 1],
  36. "clear-day" => [1, 1, 1, 1, 2, 1],
  37. "clear-night" => [1, 1, 1, 1, 1, 2],
  38. "partly-cloudy-day" => [1, 1, 1, 1, 2, 1],
  39. "partly-cloudy-night" => [1, 1, 1, 1, 1, 2],
  40. "cloudy" => [1, 1, 1, 1, 1, 1],
  41. "sleet" => [1, 1, 1, 1, 1, 1],
  42. "snow" => [1, 1, 1, 1, 1, 1],
  43. "wind" => [1, 1, 1, 2, 1, 1],
  44. "fog" => [1, 1, 1, 1, 1, 1]
  45. ];
  46. /**
  47. * Get a multiplier for the distance between the player and place.
  48. * @param float $d the number of miles between
  49. * @return float The damage multiplier
  50. */
  51. function DISTANCE_GRID($d) {
  52. $distance = floor($d * 100.0);
  53. if ($distance <= 5) { // ~250 feet
  54. return 1;
  55. } else if ($distance <= 10) { // ~500 feet
  56. return 0.95;
  57. } else if ($distance <= 20) { // ~1000 feet
  58. return 0.8;
  59. } else if ($distance <= 50) { // ~2500 feet
  60. return 0.6;
  61. } else if ($distance <= 100) { // 1 mile (5280 feet)
  62. return 0.4;
  63. } else { // Greater than 1 mile
  64. return 0.2;
  65. }
  66. }