diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-08-15 15:10:04 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-08-15 15:10:04 +0200 |
commit | 0007e50506ebaa61554bfd11e98581dada7e0cdd (patch) | |
tree | cf0064a7a165c602fb89ffa15993b3db69cef751 | |
parent | 8ab8988d01199f64151c532c59ff6c08735d4e37 (diff) |
animations!!
-rw-r--r-- | all-monsters.php | 10 | ||||
-rw-r--r-- | db/all-monsters.php | 10 | ||||
-rw-r--r-- | db/animations.json | 1 | ||||
-rw-r--r-- | db/animations.php | 13 | ||||
-rw-r--r-- | index.html | 12 | ||||
-rw-r--r-- | script.js | 110 | ||||
-rw-r--r-- | style.css | 11 |
7 files changed, 129 insertions, 38 deletions
diff --git a/all-monsters.php b/all-monsters.php deleted file mode 100644 index cf687c7..0000000 --- a/all-monsters.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -$allMonsters = []; -foreach (scandir(__DIR__ . '/modules/tuxemon/mods/tuxemon/db/monster') as $file) { - if (in_array($file, ['.', '..'])) continue; - - $allMonsters[] = pathinfo($file, PATHINFO_FILENAME); -} - -file_put_contents(__DIR__ . '/db/all-monsters.json', json_encode($allMonsters)); diff --git a/db/all-monsters.php b/db/all-monsters.php new file mode 100644 index 0000000..3907fec --- /dev/null +++ b/db/all-monsters.php @@ -0,0 +1,10 @@ +<?php + +$allMonsters = []; +foreach (scandir(dirname(__DIR__) . '/modules/tuxemon/mods/tuxemon/db/monster') as $file) { + if (in_array($file, ['.', '..'])) continue; + + $allMonsters[] = pathinfo($file, PATHINFO_FILENAME); +} + +file_put_contents(__DIR__ . '/all-monsters.json', json_encode($allMonsters)); diff --git a/db/animations.json b/db/animations.json new file mode 100644 index 0000000..8080199 --- /dev/null +++ b/db/animations.json @@ -0,0 +1 @@ +{"12_hits_for_separation10":["12_hits_for_separation10_00","12_hits_for_separation10_01","12_hits_for_separation10_02","12_hits_for_separation10_03","12_hits_for_separation10_04","12_hits_for_separation10_05","12_hits_for_separation10_06","12_hits_for_separation10_07","12_hits_for_separation10_08","12_hits_for_separation10_09","12_hits_for_separation10_10","12_hits_for_separation10_11"],"12_hits_for_separation11":["12_hits_for_separation11_00","12_hits_for_separation11_01","12_hits_for_separation11_02","12_hits_for_separation11_03","12_hits_for_separation11_04","12_hits_for_separation11_05","12_hits_for_separation11_06","12_hits_for_separation11_07","12_hits_for_separation11_08","12_hits_for_separation11_09"],"12_hits_for_separation1":["12_hits_for_separation1_00","12_hits_for_separation1_01","12_hits_for_separation1_02","12_hits_for_separation1_03","12_hits_for_separation1_04","12_hits_for_separation1_05","12_hits_for_separation1_06","12_hits_for_separation1_07","12_hits_for_separation1_08","12_hits_for_separation1_09","12_hits_for_separation1_10","12_hits_for_separation1_11"],"12_hits_for_separation2":["12_hits_for_separation2_00","12_hits_for_separation2_01","12_hits_for_separation2_02","12_hits_for_separation2_03","12_hits_for_separation2_04","12_hits_for_separation2_05","12_hits_for_separation2_06","12_hits_for_separation2_07","12_hits_for_separation2_08","12_hits_for_separation2_09","12_hits_for_separation2_10","12_hits_for_separation2_11"],"12_hits_for_separation3":["12_hits_for_separation3_00","12_hits_for_separation3_01","12_hits_for_separation3_02","12_hits_for_separation3_03","12_hits_for_separation3_04","12_hits_for_separation3_05","12_hits_for_separation3_06","12_hits_for_separation3_07","12_hits_for_separation3_08","12_hits_for_separation3_09","12_hits_for_separation3_10","12_hits_for_separation3_11"],"12_hits_for_separation4":["12_hits_for_separation4_00","12_hits_for_separation4_01","12_hits_for_separation4_02","12_hits_for_separation4_03","12_hits_for_separation4_04","12_hits_for_separation4_05","12_hits_for_separation4_06","12_hits_for_separation4_07","12_hits_for_separation4_08","12_hits_for_separation4_09"],"12_hits_for_separation5":["12_hits_for_separation5_00","12_hits_for_separation5_01","12_hits_for_separation5_02","12_hits_for_separation5_03","12_hits_for_separation5_04","12_hits_for_separation5_05","12_hits_for_separation5_06","12_hits_for_separation5_07","12_hits_for_separation5_08","12_hits_for_separation5_09","12_hits_for_separation5_10","12_hits_for_separation5_11"],"12_hits_for_separation6":["12_hits_for_separation6_00","12_hits_for_separation6_01","12_hits_for_separation6_02","12_hits_for_separation6_03","12_hits_for_separation6_04","12_hits_for_separation6_05","12_hits_for_separation6_06","12_hits_for_separation6_07","12_hits_for_separation6_08","12_hits_for_separation6_09","12_hits_for_separation6_10","12_hits_for_separation6_11"],"12_hits_for_separation7":["12_hits_for_separation7_00","12_hits_for_separation7_01","12_hits_for_separation7_02","12_hits_for_separation7_03","12_hits_for_separation7_04","12_hits_for_separation7_05","12_hits_for_separation7_06","12_hits_for_separation7_07","12_hits_for_separation7_08","12_hits_for_separation7_09"],"12_hits_for_separation8":["12_hits_for_separation8_00","12_hits_for_separation8_01","12_hits_for_separation8_02","12_hits_for_separation8_03","12_hits_for_separation8_04","12_hits_for_separation8_05","12_hits_for_separation8_06","12_hits_for_separation8_07","12_hits_for_separation8_08","12_hits_for_separation8_09"],"12_hits_for_separation9":["12_hits_for_separation9_00","12_hits_for_separation9_01","12_hits_for_separation9_02","12_hits_for_separation9_03","12_hits_for_separation9_04","12_hits_for_separation9_05","12_hits_for_separation9_06","12_hits_for_separation9_07"],"amethyst":["amethyst_00","amethyst_01","amethyst_02","amethyst_03","amethyst_04","amethyst_05"],"amethyst_absorb":["amethyst_absorb_00","amethyst_absorb_01","amethyst_absorb_02","amethyst_absorb_03","amethyst_absorb_04","amethyst_absorb_05"],"amethyst_radiate":["amethyst_radiate_00","amethyst_radiate_01","amethyst_radiate_02","amethyst_radiate_03","amethyst_radiate_04","amethyst_radiate_05"],"appearance":["appearance_00","appearance_01","appearance_02","appearance_03","appearance_04","appearance_05","appearance_06","appearance_07","appearance_08"],"beartrap":["beartrap_00","beartrap_01","beartrap_02","beartrap_03"],"bite":["bite_00","bite_01","bite_02","bite_03","bite_04","bite_05","bite_06"],"bite_zombie":["bite_zombie_00","bite_zombie_01","bite_zombie_02","bite_zombie_03","bite_zombie_04","bite_zombie_05","bite_zombie_06","bite_zombie_07","bite_zombie_08"],"blue_circle":["blue_circle_00","blue_circle_01","blue_circle_02","blue_circle_03","blue_circle_04","blue_circle_05","blue_circle_06","blue_circle_07","blue_circle_08","blue_circle_09"],"bomb":["bomb_00","bomb_01","bomb_02","bomb_03","bomb_04","bomb_05"],"bomb_bright":["bomb_bright_00","bomb_bright_01","bomb_bright_02","bomb_bright_03","bomb_bright_04","bomb_bright_05"],"breath_blue":["breath_blue_00","breath_blue_01","breath_blue_02","breath_blue_03","breath_blue_04"],"breath_fire":["breath_fire_00","breath_fire_01","breath_fire_02","breath_fire_03","breath_fire_04"],"buff_armour":["buff_armour_00","buff_armour_01","buff_armour_02","buff_armour_03","buff_armour_04","buff_armour_05","buff_armour_06","buff_armour_07"],"buff_fast":["buff_fast_00","buff_fast_01","buff_fast_02","buff_fast_03"],"buff_rage":["buff_rage_00","buff_rage_01","buff_rage_02","buff_rage_03"],"buff_ranged":["buff_ranged_00","buff_ranged_01","buff_ranged_02","buff_ranged_03","buff_ranged_04","buff_ranged_05","buff_ranged_06","buff_ranged_07"],"calling":["calling_00","calling_01","calling_02","calling_03","calling_04","calling_05"],"capture_1":["capture_1_00","capture_1_01","capture_1_02","capture_1_03","capture_1_04","capture_1_05","capture_1_06","capture_1_07"],"claw_blue":["claw_blue_00","claw_blue_01","claw_blue_02","claw_blue_03","claw_blue_04"],"claw_yellow_169":["claw_yellow_169_00","claw_yellow_169_01","claw_yellow_169_02","claw_yellow_169_03","claw_yellow_169_04"],"claws_twice_blue":["claws_twice_blue_00","claws_twice_blue_01","claws_twice_blue_02","claws_twice_blue_03","claws_twice_blue_04","claws_twice_blue_05","claws_twice_blue_06","claws_twice_blue_07","claws_twice_blue_08","claws_twice_blue_09"],"claws_twice_red":["claws_twice_red_00","claws_twice_red_01","claws_twice_red_02","claws_twice_red_03","claws_twice_red_04","claws_twice_red_05","claws_twice_red_06","claws_twice_red_07","claws_twice_red_08","claws_twice_red_09"],"clock":["clock_00","clock_01","clock_02","clock_03","clock_04","clock_05"],"constantburn":["constantburn_00","constantburn_01","constantburn_02","constantburn_03","constantburn_04","constantburn_05","constantburn_06","constantburn_07"],"crushingball":["crushingball_00","crushingball_01","crushingball_02","crushingball_03","crushingball_04","crushingball_05","crushingball_06","crushingball_07"],"crystal":["crystal_00","crystal_01","crystal_02","crystal_03","crystal_04","crystal_05"],"crystal_absorb":["crystal_absorb_00","crystal_absorb_01","crystal_absorb_02","crystal_absorb_03","crystal_absorb_04","crystal_absorb_05"],"crystal_radiate":["crystal_radiate_00","crystal_radiate_01","crystal_radiate_02","crystal_radiate_03","crystal_radiate_04","crystal_radiate_05"],"debian_240":["debian_240_00","debian_240_01","debian_240_02","debian_240_03","debian_240_04","debian_240_05","debian_240_06","debian_240_07"],"debian_64":["debian_64_00","debian_64_01","debian_64_02","debian_64_03","debian_64_04","debian_64_05","debian_64_06","debian_64_07"],"debuff_melee":["debuff_melee_00","debuff_melee_01","debuff_melee_02","debuff_melee_03","debuff_melee_04","debuff_melee_05","debuff_melee_06","debuff_melee_07"],"demiurge":["demiurge_00","demiurge_01","demiurge_02","demiurge_03","demiurge_04","demiurge_05","demiurge_06","demiurge_07","demiurge_08","demiurge_09"],"disintegrate_83":["disintegrate_83_00","disintegrate_83_01","disintegrate_83_02","disintegrate_83_03","disintegrate_83_04","disintegrate_83_05","disintegrate_83_06","disintegrate_83_07","disintegrate_83_08","disintegrate_83_09","disintegrate_83_10"],"drip_blue":["drip_blue_00","drip_blue_01","drip_blue_02","drip_blue_03","drip_blue_04","drip_blue_05","drip_blue_06"],"drip_blue_alt":["drip_blue_alt_00","drip_blue_alt_01","drip_blue_alt_02","drip_blue_alt_03","drip_blue_alt_04","drip_blue_alt_05","drip_blue_alt_06"],"drip_green":["drip_green_00","drip_green_01","drip_green_02","drip_green_03","drip_green_04","drip_green_05","drip_green_06"],"drip_orange":["drip_orange_00","drip_orange_01","drip_orange_02","drip_orange_03","drip_orange_04","drip_orange_05","drip_orange_06"],"drip_red":["drip_red_00","drip_red_01","drip_red_02","drip_red_03","drip_red_04","drip_red_05","drip_red_06"],"drip_red_alt":["drip_red_alt_00","drip_red_alt_01","drip_red_alt_02","drip_red_alt_03","drip_red_alt_04","drip_red_alt_05","drip_red_alt_06"],"emerald":["emerald_00","emerald_01","emerald_02","emerald_03","emerald_04","emerald_05"],"emerald_absorb":["emerald_absorb_00","emerald_absorb_01","emerald_absorb_02","emerald_absorb_03","emerald_absorb_04","emerald_absorb_05"],"emerald_radiate":["emerald_radiate_00","emerald_radiate_01","emerald_radiate_02","emerald_radiate_03","emerald_radiate_04","emerald_radiate_05"],"explosion_big_126":["explosion_big_126_00","explosion_big_126_01","explosion_big_126_02","explosion_big_126_03","explosion_big_126_04","explosion_big_126_05"],"explosion_burst":["explosion_burst_00","explosion_burst_01","explosion_burst_02","explosion_burst_03","explosion_burst_04","explosion_burst_05","explosion_burst_06","explosion_burst_07"],"explosion_cloud_48":["explosion_cloud_48_00","explosion_cloud_48_01","explosion_cloud_48_02","explosion_cloud_48_03","explosion_cloud_48_04","explosion_cloud_48_05","explosion_cloud_48_06","explosion_cloud_48_07"],"explosion_dusty_96":["explosion_dusty_96_00","explosion_dusty_96_01","explosion_dusty_96_02","explosion_dusty_96_03","explosion_dusty_96_04","explosion_dusty_96_05","explosion_dusty_96_06","explosion_dusty_96_07","explosion_dusty_96_08","explosion_dusty_96_09","explosion_dusty_96_10","explosion_dusty_96_11"],"explosion_ice_112":["explosion_ice_112_00","explosion_ice_112_01","explosion_ice_112_02","explosion_ice_112_03","explosion_ice_112_04","explosion_ice_112_05"],"explosion_multi_128":["explosion_multi_128_00","explosion_multi_128_01","explosion_multi_128_02","explosion_multi_128_03","explosion_multi_128_04","explosion_multi_128_05","explosion_multi_128_06","explosion_multi_128_07","explosion_multi_128_08","explosion_multi_128_09"],"explosion_mushroom_128":["explosion_mushroom_128_00","explosion_mushroom_128_01","explosion_mushroom_128_02","explosion_mushroom_128_03","explosion_mushroom_128_04","explosion_mushroom_128_05","explosion_mushroom_128_06","explosion_mushroom_128_07","explosion_mushroom_128_08","explosion_mushroom_128_09","explosion_mushroom_128_10","explosion_mushroom_128_11"],"explosion_small":["explosion_small_00","explosion_small_01","explosion_small_02","explosion_small_03","explosion_small_04"],"explosion_sun_32":["explosion_sun_32_00","explosion_sun_32_01","explosion_sun_32_02","explosion_sun_32_03","explosion_sun_32_04","explosion_sun_32_05","explosion_sun_32_06","explosion_sun_32_07"],"explosion_total_192":["explosion_total_192_00","explosion_total_192_01","explosion_total_192_02","explosion_total_192_03","explosion_total_192_04","explosion_total_192_05","explosion_total_192_06","explosion_total_192_07","explosion_total_192_08","explosion_total_192_09","explosion_total_192_10","explosion_total_192_11","explosion_total_192_12","explosion_total_192_13","explosion_total_192_14","explosion_total_192_15","explosion_total_192_16","explosion_total_192_17","explosion_total_192_18","explosion_total_192_19","explosion_total_192_20","explosion_total_192_21"],"fire_big_156":["fire_big_156_00","fire_big_156_01","fire_big_156_02","fire_big_156_03"],"fire_big_dark_96":["fire_big_dark_96_00","fire_big_dark_96_01","fire_big_dark_96_02","fire_big_dark_96_03"],"fire_fade":["fire_fade_00","fire_fade_01","fire_fade_02","fire_fade_03","fire_fade_04","fire_fade_05","fire_fade_06","fire_fade_07","fire_fade_08","fire_fade_09"],"fire_storm":["fire_storm_00","fire_storm_01","fire_storm_02","fire_storm_03","fire_storm_04","fire_storm_05","fire_storm_06","fire_storm_07","fire_storm_08","fire_storm_09","fire_storm_10","fire_storm_11"],"fireball_114":["fireball_114_00","fireball_114_01","fireball_114_02"],"firelion_back":["firelion_back_00","firelion_back_01","firelion_back_02","firelion_back_03","firelion_back_04","firelion_back_05","firelion_back_06","firelion_back_07","firelion_back_08","firelion_back_09","firelion_back_10","firelion_back_11","firelion_back_12","firelion_back_13","firelion_back_14","firelion_back_15"],"firelion_front":["firelion_front_00","firelion_front_01","firelion_front_02","firelion_front_03","firelion_front_04","firelion_front_05","firelion_front_06","firelion_front_07","firelion_front_08","firelion_front_09","firelion_front_10","firelion_front_11","firelion_front_12","firelion_front_13","firelion_front_14","firelion_front_15"],"firelion_right":["firelion_right_00","firelion_right_01","firelion_right_02","firelion_right_03","firelion_right_04","firelion_right_05","firelion_right_06","firelion_right_07","firelion_right_08","firelion_right_09","firelion_right_10","firelion_right_11","firelion_right_12","firelion_right_13","firelion_right_14","firelion_right_15"],"fireworks":["fireworks_00","fireworks_01","fireworks_02","fireworks_03","fireworks_04","fireworks_05","fireworks_06","fireworks_07","fireworks_08","fireworks_09","fireworks_10","fireworks_11","fireworks_12","fireworks_13"],"flameball_blue":["flameball_blue_00","flameball_blue_01","flameball_blue_02","flameball_blue_03"],"flameball_red":["flameball_red_00","flameball_red_01","flameball_red_02","flameball_red_03"],"gloop_blue":["gloop_blue_00","gloop_blue_01","gloop_blue_02","gloop_blue_03","gloop_blue_04","gloop_blue_05","gloop_blue_06","gloop_blue_07","gloop_blue_08"],"gloop_orange":["gloop_orange_00","gloop_orange_01","gloop_orange_02","gloop_orange_03","gloop_orange_04","gloop_orange_05","gloop_orange_06","gloop_orange_07","gloop_orange_08"],"gloop_violet":["gloop_violet_00","gloop_violet_01","gloop_violet_02","gloop_violet_03","gloop_violet_04","gloop_violet_05","gloop_violet_06","gloop_violet_07","gloop_violet_08"],"green_circle":["green_circle_00","green_circle_01","green_circle_02","green_circle_03","green_circle_04","green_circle_05","green_circle_06","green_circle_07","green_circle_08","green_circle_09"],"heal_burst_120":["heal_burst_120_00","heal_burst_120_01","heal_burst_120_02","heal_burst_120_03","heal_burst_120_04"],"heal_cross_120":["heal_cross_120_00","heal_cross_120_01","heal_cross_120_02","heal_cross_120_03","heal_cross_120_04","heal_cross_120_05"],"heal_swarm":["heal_swarm_00","heal_swarm_01","heal_swarm_02","heal_swarm_03","heal_swarm_04","heal_swarm_05","heal_swarm_06"],"ice_storm":["ice_storm_00","ice_storm_01","ice_storm_02","ice_storm_03","ice_storm_04","ice_storm_05","ice_storm_06","ice_storm_07","ice_storm_08","ice_storm_09","ice_storm_10","ice_storm_11"],"icetacle":["icetacle_00","icetacle_01","icetacle_02","icetacle_03","icetacle_04","icetacle_05","icetacle_06","icetacle_07","icetacle_08","icetacle_09","icetacle_10","icetacle_11","icetacle_12","icetacle_13","icetacle_14","icetacle_15"],"join_80":["join_80_00","join_80_01","join_80_02","join_80_03","join_80_04","join_80_05","join_80_06","join_80_07"],"lance_ice":["lance_ice_00","lance_ice_01","lance_ice_02","lance_ice_03","lance_ice_04"],"lightning_bolt_138":["lightning_bolt_138_00","lightning_bolt_138_01","lightning_bolt_138_02","lightning_bolt_138_03","lightning_bolt_138_04"],"lightning_claw":["lightning_claw_00","lightning_claw_01","lightning_claw_02","lightning_claw_03","lightning_claw_04","lightning_claw_05","lightning_claw_06","lightning_claw_07","lightning_claw_08","lightning_claw_09","lightning_claw_10","lightning_claw_11","lightning_claw_12","lightning_claw_13","lightning_claw_14","lightning_claw_15"],"lightning_claw_large":["lightning_claw_large_00","lightning_claw_large_01","lightning_claw_large_02","lightning_claw_large_03","lightning_claw_large_04","lightning_claw_large_05","lightning_claw_large_06","lightning_claw_large_07","lightning_claw_large_08","lightning_claw_large_09","lightning_claw_large_10","lightning_claw_large_11","lightning_claw_large_12","lightning_claw_large_13","lightning_claw_large_14","lightning_claw_large_15"],"lightning_spheres":["lightning_spheres_00","lightning_spheres_01","lightning_spheres_02","lightning_spheres_03","lightning_spheres_04","lightning_spheres_05","lightning_spheres_06","lightning_spheres_07"],"meltdown":["meltdown_00","meltdown_01","meltdown_02","meltdown_03","meltdown_04","meltdown_05"],"metal_delete":["metal_delete_00","metal_delete_01","metal_delete_02","metal_delete_03","metal_delete_04","metal_delete_05"],"metallic_absorb":["metallic_absorb_00","metallic_absorb_01","metallic_absorb_02","metallic_absorb_03","metallic_absorb_04","metallic_absorb_05"],"metallic_radiate":["metallic_radiate_00","metallic_radiate_01","metallic_radiate_02","metallic_radiate_03","metallic_radiate_04","metallic_radiate_05"],"misc_hit_preview1":["misc_hit_preview1_00","misc_hit_preview1_01","misc_hit_preview1_02","misc_hit_preview1_03","misc_hit_preview1_04","misc_hit_preview1_05","misc_hit_preview1_06","misc_hit_preview1_07","misc_hit_preview1_08","misc_hit_preview1_09"],"misc_hit_preview2":["misc_hit_preview2_00","misc_hit_preview2_01","misc_hit_preview2_02","misc_hit_preview2_03","misc_hit_preview2_04","misc_hit_preview2_05","misc_hit_preview2_06","misc_hit_preview2_07","misc_hit_preview2_08","misc_hit_preview2_09"],"misc_hit_preview3":["misc_hit_preview3_00","misc_hit_preview3_01","misc_hit_preview3_02","misc_hit_preview3_03","misc_hit_preview3_04","misc_hit_preview3_05","misc_hit_preview3_06","misc_hit_preview3_07","misc_hit_preview3_08","misc_hit_preview3_09","misc_hit_preview3_10","misc_hit_preview3_11"],"misc_hit_preview4":["misc_hit_preview4_00","misc_hit_preview4_01","misc_hit_preview4_02","misc_hit_preview4_03","misc_hit_preview4_04","misc_hit_preview4_05","misc_hit_preview4_06","misc_hit_preview4_07","misc_hit_preview4_08","misc_hit_preview4_09"],"misc_hit_preview5":["misc_hit_preview5_00","misc_hit_preview5_01","misc_hit_preview5_02","misc_hit_preview5_03","misc_hit_preview5_04","misc_hit_preview5_05","misc_hit_preview5_06","misc_hit_preview5_07","misc_hit_preview5_08","misc_hit_preview5_09"],"pound":["pound_00","pound_01","pound_02","pound_03"],"pound_bright":["pound_bright_00","pound_bright_01","pound_bright_02","pound_bright_03","pound_bright_04"],"pound_rock":["pound_rock_00","pound_rock_01","pound_rock_02","pound_rock_03","pound_rock_04"],"power_arc_154":["power_arc_154_00","power_arc_154_01","power_arc_154_02","power_arc_154_03","power_arc_154_04"],"pulse":["pulse_00","pulse_01","pulse_02","pulse_03","pulse_04","pulse_05"],"pulse_absorb":["pulse_absorb_00","pulse_absorb_01","pulse_absorb_02","pulse_absorb_03","pulse_absorb_04","pulse_absorb_05"],"pulse_radiate":["pulse_radiate_00","pulse_radiate_01","pulse_radiate_02","pulse_radiate_03","pulse_radiate_04","pulse_radiate_05"],"pushtrap_front":["pushtrap_front_00","pushtrap_front_01","pushtrap_front_02","pushtrap_front_03","pushtrap_front_04","pushtrap_front_05","pushtrap_front_06","pushtrap_front_07","pushtrap_front_08","pushtrap_front_09","pushtrap_front_10"],"pushtrap_right":["pushtrap_right_00","pushtrap_right_01","pushtrap_right_02","pushtrap_right_03","pushtrap_right_04","pushtrap_right_05","pushtrap_right_06","pushtrap_right_07","pushtrap_right_08","pushtrap_right_09","pushtrap_right_10"],"red_circle":["red_circle_00","red_circle_01","red_circle_02","red_circle_03","red_circle_04","red_circle_05","red_circle_06","red_circle_07","red_circle_08","red_circle_09"],"rockfall_193":["rockfall_193_00","rockfall_193_01","rockfall_193_02","rockfall_193_03","rockfall_193_04","rockfall_193_05","rockfall_193_06","rockfall_193_07","rockfall_193_08","rockfall_193_09","rockfall_193_10"],"rockfall_264":["rockfall_264_00","rockfall_264_01","rockfall_264_02","rockfall_264_03","rockfall_264_04","rockfall_264_05","rockfall_264_06","rockfall_264_07","rockfall_264_08","rockfall_264_09","rockfall_264_10"],"ruby":["ruby_00","ruby_01","ruby_02","ruby_03","ruby_04","ruby_05"],"ruby_absorb":["ruby_absorb_00","ruby_absorb_01","ruby_absorb_02","ruby_absorb_03","ruby_absorb_04","ruby_absorb_05"],"ruby_radiate":["ruby_radiate_00","ruby_radiate_01","ruby_radiate_02","ruby_radiate_03","ruby_radiate_04","ruby_radiate_05"],"screen":["screen_00","screen_01","screen_02","screen_03","screen_04","screen_05","screen_06","screen_07","screen_08","screen_09","screen_10","screen_11","screen_12","screen_13","screen_14","screen_15","screen_16","screen_17","screen_18"],"shield_fire":["shield_fire_00","shield_fire_01","shield_fire_02","shield_fire_03","shield_fire_04","shield_fire_05","shield_fire_06","shield_fire_07","shield_fire_08","shield_fire_09","shield_fire_10","shield_fire_11","shield_fire_12","shield_fire_13","shield_fire_14","shield_fire_15"],"shield_ice":["shield_ice_00","shield_ice_01","shield_ice_02","shield_ice_03","shield_ice_04","shield_ice_05","shield_ice_06","shield_ice_07","shield_ice_08","shield_ice_09","shield_ice_10","shield_ice_11","shield_ice_12","shield_ice_13","shield_ice_14","shield_ice_15"],"shield_lava":["shield_lava_00","shield_lava_01","shield_lava_02","shield_lava_03","shield_lava_04","shield_lava_05","shield_lava_06","shield_lava_07","shield_lava_08","shield_lava_09","shield_lava_10","shield_lava_11","shield_lava_12","shield_lava_13","shield_lava_14","shield_lava_15"],"shield_rock":["shield_rock_00","shield_rock_01","shield_rock_02","shield_rock_03","shield_rock_04","shield_rock_05","shield_rock_06","shield_rock_07","shield_rock_08","shield_rock_09","shield_rock_10","shield_rock_11","shield_rock_12","shield_rock_13","shield_rock_14","shield_rock_15"],"shield_turtle":["shield_turtle_00","shield_turtle_01","shield_turtle_02","shield_turtle_03","shield_turtle_04","shield_turtle_05","shield_turtle_06","shield_turtle_07","shield_turtle_08","shield_turtle_09","shield_turtle_10","shield_turtle_11","shield_turtle_12","shield_turtle_13","shield_turtle_14","shield_turtle_15"],"shield_turtle_right":["shield_turtle_right_00","shield_turtle_right_01","shield_turtle_right_02","shield_turtle_right_03","shield_turtle_right_04","shield_turtle_right_05","shield_turtle_right_06","shield_turtle_right_07","shield_turtle_right_08","shield_turtle_right_09","shield_turtle_right_10","shield_turtle_right_11","shield_turtle_right_12","shield_turtle_right_13","shield_turtle_right_14","shield_turtle_right_15"],"skull":["skull_00","skull_01","skull_02","skull_03"],"skull_fire":["skull_fire_00","skull_fire_01","skull_fire_02","skull_fire_03","skull_fire_04","skull_fire_05","skull_fire_06","skull_fire_07"],"slash_200":["slash_200_00","slash_200_01","slash_200_02","slash_200_03","slash_200_04","slash_200_05"],"slash_double_188":["slash_double_188_00","slash_double_188_01","slash_double_188_02","slash_double_188_03","slash_double_188_04","slash_double_188_05"],"slash_fire":["slash_fire_00","slash_fire_01","slash_fire_02","slash_fire_03"],"slash_power":["slash_power_00","slash_power_01","slash_power_02","slash_power_03","slash_power_04","slash_power_05","slash_power_06","slash_power_07"],"smokebomb":["smokebomb_00","smokebomb_01","smokebomb_02","smokebomb_03","smokebomb_04","smokebomb_05","smokebomb_06","smokebomb_07","smokebomb_08"],"smokebomb_plume":["smokebomb_plume_00","smokebomb_plume_01","smokebomb_plume_02","smokebomb_plume_03","smokebomb_plume_04","smokebomb_plume_05"],"smokebomb_puff_128":["smokebomb_puff_128_00","smokebomb_puff_128_01","smokebomb_puff_128_02","smokebomb_puff_128_03","smokebomb_puff_128_04"],"snake_front_128":["snake_front_128_00","snake_front_128_01","snake_front_128_02","snake_front_128_03","snake_front_128_04","snake_front_128_05","snake_front_128_06","snake_front_128_07","snake_front_128_08","snake_front_128_09","snake_front_128_10","snake_front_128_11","snake_front_128_12","snake_front_128_13","snake_front_128_14","snake_front_128_15"],"snake_right":["snake_right_00","snake_right_01","snake_right_02","snake_right_03","snake_right_04","snake_right_05","snake_right_06","snake_right_07","snake_right_08","snake_right_09","snake_right_10","snake_right_11","snake_right_12","snake_right_13","snake_right_14","snake_right_15"],"snake_up_128":["snake_up_128_00","snake_up_128_01","snake_up_128_02","snake_up_128_03","snake_up_128_04","snake_up_128_05","snake_up_128_06","snake_up_128_07","snake_up_128_08","snake_up_128_09","snake_up_128_10","snake_up_128_11","snake_up_128_12","snake_up_128_13","snake_up_128_14","snake_up_128_15"],"sparks_blue":["sparks_blue_00","sparks_blue_01","sparks_blue_02","sparks_blue_03"],"sparks_blue_alt":["sparks_blue_alt_00","sparks_blue_alt_01","sparks_blue_alt_02","sparks_blue_alt_03"],"sparks_gold":["sparks_gold_00","sparks_gold_01","sparks_gold_02","sparks_gold_03"],"sparks_gold_alt":["sparks_gold_alt_00","sparks_gold_alt_01","sparks_gold_alt_02","sparks_gold_alt_03"],"sparks_green":["sparks_green_00","sparks_green_01","sparks_green_02","sparks_green_03"],"sparks_green_alt":["sparks_green_alt_00","sparks_green_alt_01","sparks_green_alt_02","sparks_green_alt_03"],"sparks_red":["sparks_red_00","sparks_red_01","sparks_red_02","sparks_red_03"],"sparks_white":["sparks_white_00","sparks_white_01","sparks_white_02","sparks_white_03"],"sparks_white_alt":["sparks_white_alt_00","sparks_white_alt_01","sparks_white_alt_02","sparks_white_alt_03"],"spike_ice":["spike_ice_00","spike_ice_01","spike_ice_02","spike_ice_03","spike_ice_04","spike_ice_05","spike_ice_06"],"spike_rock":["spike_rock_00","spike_rock_01","spike_rock_02","spike_rock_03","spike_rock_04","spike_rock_05","spike_rock_06"],"spikes_fire":["spikes_fire_00","spikes_fire_01","spikes_fire_02","spikes_fire_03","spikes_fire_04","spikes_fire_05","spikes_fire_06","spikes_fire_07","spikes_fire_08","spikes_fire_09","spikes_fire_10","spikes_fire_11","spikes_fire_12","spikes_fire_13"],"spikes_ice":["spikes_ice_00","spikes_ice_01","spikes_ice_02","spikes_ice_03","spikes_ice_04","spikes_ice_05","spikes_ice_06","spikes_ice_07","spikes_ice_08","spikes_ice_09"],"spikes_metal":["spikes_metal_00","spikes_metal_01","spikes_metal_02","spikes_metal_03","spikes_metal_04","spikes_metal_05","spikes_metal_06","spikes_metal_07","spikes_metal_08","spikes_metal_09","spikes_metal_10","spikes_metal_11","spikes_metal_12","spikes_metal_13"],"spikes_rock":["spikes_rock_00","spikes_rock_01","spikes_rock_02","spikes_rock_03","spikes_rock_04","spikes_rock_05","spikes_rock_06","spikes_rock_07","spikes_rock_08","spikes_rock_09"],"tentacles_water":["tentacles_water_00","tentacles_water_01","tentacles_water_02","tentacles_water_03","tentacles_water_04","tentacles_water_05","tentacles_water_06","tentacles_water_07","tentacles_water_08","tentacles_water_09","tentacles_water_10","tentacles_water_11","tentacles_water_12","tentacles_water_13","tentacles_water_14","tentacles_water_15"],"thunderstrike":["thunderstrike_00","thunderstrike_01","thunderstrike_02","thunderstrike_03","thunderstrike_04"],"tornado_basic":["tornado_basic_00","tornado_basic_01","tornado_basic_02","tornado_basic_03","tornado_basic_04","tornado_basic_05","tornado_basic_06","tornado_basic_07","tornado_basic_08","tornado_basic_09","tornado_basic_10","tornado_basic_11","tornado_basic_12"],"tornado_bulk":["tornado_bulk_00","tornado_bulk_01","tornado_bulk_02","tornado_bulk_03","tornado_bulk_04","tornado_bulk_05","tornado_bulk_06","tornado_bulk_07","tornado_bulk_08","tornado_bulk_09","tornado_bulk_10","tornado_bulk_11","tornado_bulk_12","tornado_bulk_13","tornado_bulk_14","tornado_bulk_15"],"tornado_volume":["tornado_volume_00","tornado_volume_01","tornado_volume_02","tornado_volume_03","tornado_volume_04","tornado_volume_05","tornado_volume_06","tornado_volume_07","tornado_volume_08","tornado_volume_09","tornado_volume_10","tornado_volume_11"],"triforce_163":["triforce_163_00","triforce_163_01","triforce_163_02","triforce_163_03","triforce_163_04","triforce_163_05"],"triple_whammy_80":["triple_whammy_80_00","triple_whammy_80_01","triple_whammy_80_02","triple_whammy_80_03","triple_whammy_80_04","triple_whammy_80_05","triple_whammy_80_06"],"turquoise_circle":["turquoise_circle_00","turquoise_circle_01","turquoise_circle_02","turquoise_circle_03","turquoise_circle_04","turquoise_circle_05","turquoise_circle_06","turquoise_circle_07","turquoise_circle_08","turquoise_circle_09"],"tux_attack":["tux_attack_00","tux_attack_01","tux_attack_02","tux_attack_03","tux_attack_04","tux_attack_05"],"ubuntu":["ubuntu_00","ubuntu_01","ubuntu_02","ubuntu_03","ubuntu_04","ubuntu_05"],"wall_fire":["wall_fire_00","wall_fire_01","wall_fire_02","wall_fire_03","wall_fire_04","wall_fire_05","wall_fire_06","wall_fire_07"],"wall_ice":["wall_ice_00","wall_ice_01","wall_ice_02","wall_ice_03","wall_ice_04","wall_ice_05","wall_ice_06","wall_ice_07"],"wall_wood":["wall_wood_00","wall_wood_01","wall_wood_02","wall_wood_03","wall_wood_04","wall_wood_05","wall_wood_06","wall_wood_07"],"warp":["warp_00","warp_01","warp_02","warp_03","warp_04","warp_05","warp_06","warp_07"],"waterfall":["waterfall_00","waterfall_01","waterfall_02","waterfall_03","waterfall_04","waterfall_05","waterfall_06","waterfall_07"],"watershot":["watershot_00","watershot_01","watershot_02","watershot_03","watershot_04","watershot_05","watershot_06"],"waterspurt":["waterspurt_00","waterspurt_01","waterspurt_02","waterspurt_03","waterspurt_04","waterspurt_05","waterspurt_06","waterspurt_07","waterspurt_08","waterspurt_09"],"whisp_fire":["whisp_fire_00","whisp_fire_01","whisp_fire_02","whisp_fire_03","whisp_fire_04"],"x_attack":["x_attack_00","x_attack_01","x_attack_02","x_attack_03","x_attack_04","x_attack_05"],"yellow_circle":["yellow_circle_00","yellow_circle_01","yellow_circle_02","yellow_circle_03","yellow_circle_04","yellow_circle_05","yellow_circle_06","yellow_circle_07","yellow_circle_08","yellow_circle_09"]}
\ No newline at end of file diff --git a/db/animations.php b/db/animations.php new file mode 100644 index 0000000..8e3decc --- /dev/null +++ b/db/animations.php @@ -0,0 +1,13 @@ +<?php + +$animations = []; +foreach (scandir(dirname(__DIR__) . '/modules/tuxemon/mods/tuxemon/animations/technique') as $file) { + if (in_array($file, ['.', '..'])) continue; + + $animationFileName = pathinfo($file, PATHINFO_FILENAME); + $animationName = substr($animationFileName, 0, -3); + + $animations[$animationName][] = $animationFileName; +} + +file_put_contents(__DIR__ . '/animations.json', json_encode($animations)); @@ -8,10 +8,14 @@ <div id="party"></div> <div id="battle"> - <div id="battle__enemy"></div> + <div id="battle__enemy"> + <img class="battle__monster-sprite__animation" src="" draggable="false" /> + </div> <div id="battle__player"></div> </div> + + <div id="catch">CATCH</div> </div> <template id="tpl___party__monster"> @@ -52,11 +56,9 @@ </div> <div class="battle__monster-visual"> <div class="battle__monster-sprite"> - <img src="" draggable="false" /> - </div> - <div class="battle__monster-technique"> - + <img class="battle__monster-img" src="" draggable="false" /> </div> + <div class="battle__monster-technique"></div> </div> </div> </template> @@ -1,5 +1,6 @@ const DB = { allMonsters: [], + allAnimations: {}, monsters: {}, shapes: {}, elements: {}, @@ -74,7 +75,6 @@ class Monster { tasteWarm = TasteWarm.tasteless; tasteCold = TasteCold.tasteless; - name = ''; gender = ''; statusModifiers = { @@ -163,16 +163,16 @@ class Monster { ); } - canEvolve () { - if (this.evolutions.length === 0) { - return; - } + getPossibleEvolutions () { + return this.evolutions.filter((evolution) => this.level >= evolution.at_level && (!evolution.item || this.heldItem === evolution.item)); + } - return this.level >= this.evolutions[0].at_level; + canEvolve () { + return this.getPossibleEvolutions().length > 0; } evolve () { - const evolution = this.evolutions[0]; + const evolution = this.getPossibleEvolutions[0]; const statusPreEvolve = this.status; const hpPreEvolve = this.hp; @@ -264,6 +264,10 @@ class Technique { get range () { return DB.techniques[this.slug].range; } + + get animation () { + return DB.techniques[this.slug].animation; + } } function simpleDamageMultiplier (techniqueTypes, targetTypes) { @@ -374,13 +378,14 @@ function slugToName (slug) { (async function () { DB.allMonsters = await fetch('/db/all-monsters.json').then((response) => response.json()); + DB.allAnimations = await fetch('/db/animations.json').then((response) => response.json()); DB.shapes = await fetch('/modules/tuxemon/mods/tuxemon/db/shape/shapes.json').then((response) => response.json()); for (const element of Object.keys(ElementType)) { DB.elements[element] = await fetch(`/modules/tuxemon/mods/tuxemon/db/element/${element}.json`).then((response) => response.json()); } const state = new State(); - state.enemy.monster = await fetchMonster('drashimi'); + state.enemy.monster = await fetchMonster('grintot'); state.partyMonsters = [ await fetchMonster('corvix'), @@ -407,6 +412,9 @@ function slugToName (slug) { const UI = { activeMonster: null, + damageAnimationInterval: null, + damageAnimationNumber: 0, + getTemplate (template) { var tpl = document.createElement('div'); tpl.innerHTML = template.trim(); @@ -449,8 +457,8 @@ function slugToName (slug) { const damageMultiplier = simpleDamageMultiplier(state.activeTechnique.types, state.enemy.monster.types); damageNode.style.fontSize = damageMultiplier + 'rem'; - damageNode.style.left = event.pageX - battleEnemy.offsetLeft; - damageNode.style.top = event.pageY - battleEnemy.offsetTop; + damageNode.style.top = event.pageY - battleEnemy.offsetTop + (Math.random() * 40 - 20); + damageNode.style.left = event.pageX - battleEnemy.offsetLeft + (Math.random() * 40 - 20); damageNode.style.color = mixColors(...state.activeTechnique.types.map((type) => standardizeColor(ElementTypeColor[type]))); @@ -460,12 +468,33 @@ function slugToName (slug) { battleEnemy.appendChild(damageNode); setTimeout(() => damageNode.remove(), (damageNodeDuration * 1000) - 500); - const enemyImg = battleEnemy.querySelector('img'); + const enemyImg = battleEnemy.querySelector('.battle__monster-img'); const imgClickDuration = 0.1; enemyImg.style.transitionDuration = imgClickDuration + 's'; enemyImg.classList.add('damaged'); clearTimeout(clickTimeout); clickTimeout = setTimeout(() => enemyImg.classList.remove('damaged'), imgClickDuration * 1000); + + var enemyAnimation = battleEnemy.querySelector('.battle__monster-sprite__animation'); + // enemyAnimation.style.top = enemyImg.getBoundingClientRect().top; + // enemyAnimation.style.left = enemyImg.getBoundingClientRect().left; + if (!this.damageAnimationInterval) { + this.damageAnimationInterval = setInterval(() => { + enemyAnimation.src = `/modules/tuxemon/mods/tuxemon/animations/technique/${state.activeTechnique.animation}_0${this.damageAnimationNumber}.png`; + enemyAnimation.style.top = event.clientY - (enemyAnimation.clientHeight / 2); + enemyAnimation.style.left = event.clientX - (enemyAnimation.clientWidth / 2); + console.log(enemyAnimation.src); + + this.damageAnimationNumber++; + + if (this.damageAnimationNumber === DB.allAnimations[state.activeTechnique.animation].length) { + clearInterval(this.damageAnimationInterval); + this.damageAnimationInterval = null; + this.damageAnimationNumber = 0; + enemyAnimation.src = ''; + } + }, 50); + } }, addPartyMonster (slug) { @@ -476,22 +505,30 @@ function slugToName (slug) { partyMonster.dataset.slug = slug; partyMonster.querySelector('img').src = `/modules/tuxemon/mods/tuxemon/gfx/sprites/battle/${slug}-front.png`; - partyMonster.addEventListener('click', async (event) => { + partyMonster.addEventListener('click', (event) => { let target = event.target; while (target.parentNode.id !== 'party') { target = target.parentNode; } state.activeMonster = state.partyMonsters[Array.prototype.indexOf.call(document.querySelector('#party').children, target)]; - state.activeTechnique = await fetchTechnique(state.activeMonster.moveset[0].technique); - - UI.setBattleMonster(state.activeMonster, 'player'); + UI.setActiveMonster(); }); partyMonster.style.cursor = 'pointer'; party.appendChild(partyMonster); }, + async setActiveMonster () { + let activeMoveIndex = 0; + while ((await fetchTechnique(state.activeMonster.moveset[activeMoveIndex].technique)).power === 0) { + activeMoveIndex++; + } + state.activeTechnique = await fetchTechnique(state.activeMonster.moveset[activeMoveIndex].technique); + + UI.setBattleMonster(state.activeMonster, 'player'); + }, + setBattleMonster (monster, where) { let battleMonster = document.createElement('div'); battleMonster.innerHTML = templateBattleMonster.trim(); @@ -526,22 +563,43 @@ function slugToName (slug) { const movesetList = UI.getTemplate(templateMovesetList); for (const move of state.activeMonster.moveset) { const technique = await fetchTechnique(move.technique); + + if (technique.power === 0) { + continue; + } + const movesetItem = UI.getTemplate(templateMovesetItem); - movesetItem.textContent = slugToName(technique.slug) + ' - ' + technique.types + ' - ' + technique.power; + movesetItem.textContent = slugToName(technique.slug) + ' - ' + technique.types + ' - ' + technique.power + ' - ' + move.level_learned; movesetItem.addEventListener('click', () => { + if (movesetItem.getAttribute('disabled')) { + return false; + } + state.activeTechnique = technique; UI.setBattleMonster(state.activeMonster, 'player'); popup.remove(); }); + if (state.activeMonster.level < move.level_learned) { + movesetItem.setAttribute('disabled', true); + } + movesetList.appendChild(movesetItem); } popup.querySelector('.popup').appendChild(movesetList); document.body.appendChild(popup); }, + + async createNewEnemyMonster () { + state.enemy.monster = await fetchMonster(DB.allMonsters[Math.floor(Math.random() * DB.allMonsters.length)]); + state.enemy.monster.level = Math.ceil(Math.random() * state.activeMonster.level); + // state.enemy.monster.experienceModifier = state.enemy.monster.level; + state.enemy.monster.moneyModifier = state.enemy.monster.level; + UI.setBattleMonster(state.enemy.monster, 'enemy'); + }, }; for (const monster of state.partyMonsters) { @@ -550,6 +608,7 @@ function slugToName (slug) { UI.setBattleMonster(state.activeMonster, 'player'); UI.setBattleMonster(state.enemy.monster, 'enemy'); + UI.setActiveMonster(); var clickTimeout; document.querySelector('#battle__enemy').addEventListener('click', async (event) => { @@ -560,19 +619,16 @@ function slugToName (slug) { if (state.enemy.monster.hp <= 0) { const faintedMonster = state.enemy.monster; - state.enemy.monster = await fetchMonster(DB.allMonsters[Math.floor(Math.random() * DB.allMonsters.length)]); - state.enemy.monster.level = Math.ceil(Math.random() * state.activeMonster.level); - state.enemy.monster.moneyModifier = state.enemy.monster.level; - UI.setBattleMonster(state.enemy.monster, 'enemy'); + await UI.createNewEnemyMonster(); state.money += faintedMonster.level * faintedMonster.moneyModifier; - state.activeMonster.exp += calculateAwardedExperience(state.activeMonster, faintedMonster); + state.activeMonster.exp += calculateAwardedExperience(state.activeMonster, faintedMonster) * 50; state.activeMonster.levelUp(); if (state.activeMonster.canEvolve()) { await fetchMonster(state.activeMonster.evolutions[0].monster_slug); state.activeMonster.evolve(); - state.activeTechnique = await fetchTechnique(state.activeMonster.moveset[0].technique); + UI.setActiveMonster(); } UI.setBattleMonster(state.activeMonster, 'player'); @@ -580,4 +636,14 @@ function slugToName (slug) { UI.setHp(state.enemy.monster, battleEnemy); money.textContent = state.money; }); + + document.querySelector('#catch').addEventListener('click', async (event) => { + const caughtMonster = new Monster(state.enemy.monster.slug); + caughtMonster.level = state.enemy.monster.level; + + state.partyMonsters.push(caughtMonster); + + UI.createNewEnemyMonster(); + UI.addPartyMonster(caughtMonster.slug); + }); })(); @@ -105,6 +105,10 @@ img { .battle__monster-sprite img.damaged { filter: brightness(2); } +.battle__monster-sprite__animation { + position: fixed; + z-index: 10; +} .battle__monster-technique { background-color: beige; @@ -145,6 +149,11 @@ img { transition: background-color; } +.moveset__item[disabled] { + color: #ebebeb; +} + + #enemy { position: relative; user-select: none; @@ -172,7 +181,7 @@ img { .damage { position: absolute; - color: red; + z-index: 11; animation: float-up-and-disappear; } |