diff --git a/public/images/items.json b/public/images/items.json index 70d7ce02d..7b11c1d77 100644 --- a/public/images/items.json +++ b/public/images/items.json @@ -4,11 +4,32 @@ "image": "items.png", "format": "RGBA8888", "size": { - "w": 200, - "h": 206 + "w": 229, + "h": 229 }, "scale": 1, "frames": [ + { + "filename": "linking_cord", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 3, + "y": 3, + "w": 27, + "h": 26 + }, + "frame": { + "x": 0, + "y": 0, + "w": 27, + "h": 26 + } + }, { "filename": "choice_scarf", "rotated": false, @@ -24,7 +45,49 @@ "h": 24 }, "frame": { - "x": 0, + "x": 27, + "y": 0, + "w": 24, + "h": 24 + } + }, + { + "filename": "muscle_band", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 4, + "w": 24, + "h": 24 + }, + "frame": { + "x": 51, + "y": 0, + "w": 24, + "h": 24 + } + }, + { + "filename": "silk_scarf", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 4, + "w": 24, + "h": 24 + }, + "frame": { + "x": 75, "y": 0, "w": 24, "h": 24 @@ -45,14 +108,14 @@ "h": 24 }, "frame": { - "x": 0, - "y": 24, + "x": 99, + "y": 0, "w": 24, "h": 24 } }, { - "filename": "big_root", + "filename": "clefairy_doll", "rotated": false, "trimmed": true, "sourceSize": { @@ -61,15 +124,15 @@ }, "spriteSourceSize": { "x": 4, - "y": 4, - "w": 23, - "h": 24 + "y": 5, + "w": 24, + "h": 23 }, "frame": { - "x": 24, + "x": 123, "y": 0, - "w": 23, - "h": 24 + "w": 24, + "h": 23 } }, { @@ -87,33 +150,12 @@ "h": 23 }, "frame": { - "x": 0, - "y": 48, + "x": 147, + "y": 0, "w": 24, "h": 23 } }, - { - "filename": "kings_rock", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 4, - "w": 23, - "h": 24 - }, - "frame": { - "x": 24, - "y": 24, - "w": 23, - "h": 24 - } - }, { "filename": "scope-lens", "rotated": false, @@ -129,14 +171,14 @@ "h": 23 }, "frame": { - "x": 47, + "x": 171, "y": 0, "w": 24, "h": 23 } }, { - "filename": "exp_share", + "filename": "twisted_spoon", "rotated": false, "trimmed": true, "sourceSize": { @@ -147,17 +189,38 @@ "x": 4, "y": 5, "w": 24, - "h": 22 + "h": 23 }, "frame": { - "x": 0, - "y": 71, + "x": 195, + "y": 0, "w": 24, - "h": 22 + "h": 23 } }, { - "filename": "max_revive", + "filename": "big_root", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 4, + "w": 23, + "h": 24 + }, + "frame": { + "x": 123, + "y": 23, + "w": 23, + "h": 24 + } + }, + { + "filename": "kings_rock", "rotated": false, "trimmed": true, "sourceSize": { @@ -167,13 +230,13 @@ "spriteSourceSize": { "x": 5, "y": 4, - "w": 22, + "w": 23, "h": 24 }, "frame": { - "x": 24, - "y": 48, - "w": 22, + "x": 146, + "y": 23, + "w": 23, "h": 24 } }, @@ -192,12 +255,159 @@ "h": 23 }, "frame": { - "x": 47, + "x": 169, "y": 23, "w": 23, "h": 23 } }, + { + "filename": "exp_share", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 5, + "w": 24, + "h": 22 + }, + "frame": { + "x": 192, + "y": 23, + "w": 24, + "h": 22 + } + }, + { + "filename": "revive", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 10, + "y": 8, + "w": 12, + "h": 17 + }, + "frame": { + "x": 216, + "y": 23, + "w": 12, + "h": 17 + } + }, + { + "filename": "max_revive", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 4, + "w": 22, + "h": 24 + }, + "frame": { + "x": 192, + "y": 45, + "w": 22, + "h": 24 + } + }, + { + "filename": "full_heal", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 9, + "y": 4, + "w": 15, + "h": 23 + }, + "frame": { + "x": 214, + "y": 45, + "w": 15, + "h": 23 + } + }, + { + "filename": "prism_scale", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 9, + "y": 8, + "w": 15, + "h": 15 + }, + "frame": { + "x": 214, + "y": 68, + "w": 15, + "h": 15 + } + }, + { + "filename": "healing_charm", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 23, + "h": 22 + }, + "frame": { + "x": 169, + "y": 46, + "w": 23, + "h": 22 + } + }, + { + "filename": "black_belt", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 4, + "w": 22, + "h": 23 + }, + "frame": { + "x": 27, + "y": 24, + "w": 22, + "h": 23 + } + }, { "filename": "fire_stone", "rotated": false, @@ -213,8 +423,8 @@ "h": 23 }, "frame": { - "x": 71, - "y": 0, + "x": 0, + "y": 26, "w": 22, "h": 23 } @@ -234,14 +444,14 @@ "h": 23 }, "frame": { - "x": 0, - "y": 93, + "x": 49, + "y": 24, "w": 22, "h": 23 } }, { - "filename": "healing_charm", + "filename": "never_melt_ice", "rotated": false, "trimmed": true, "sourceSize": { @@ -251,35 +461,14 @@ "spriteSourceSize": { "x": 5, "y": 5, - "w": 23, - "h": 22 + "w": 22, + "h": 23 }, "frame": { - "x": 70, - "y": 23, - "w": 23, - "h": 22 - } - }, - { - "filename": "oval_charm", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, - "y": 4, - "w": 21, - "h": 24 - }, - "frame": { - "x": 93, - "y": 0, - "w": 21, - "h": 24 + "x": 71, + "y": 24, + "w": 22, + "h": 23 } }, { @@ -297,12 +486,33 @@ "h": 23 }, "frame": { - "x": 0, - "y": 116, + "x": 93, + "y": 24, "w": 22, "h": 23 } }, + { + "filename": "oval_charm", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 4, + "w": 21, + "h": 24 + }, + "frame": { + "x": 22, + "y": 47, + "w": 21, + "h": 24 + } + }, { "filename": "shiny_charm", "rotated": false, @@ -318,12 +528,33 @@ "h": 24 }, "frame": { - "x": 114, - "y": 0, + "x": 0, + "y": 49, "w": 21, "h": 24 } }, + { + "filename": "charcoal", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 43, + "y": 47, + "w": 22, + "h": 22 + } + }, { "filename": "electirizer", "rotated": false, @@ -339,8 +570,8 @@ "h": 22 }, "frame": { - "x": 0, - "y": 139, + "x": 65, + "y": 47, "w": 22, "h": 22 } @@ -360,8 +591,407 @@ "h": 22 }, "frame": { - "x": 135, - "y": 0, + "x": 87, + "y": 47, + "w": 22, + "h": 22 + } + }, + { + "filename": "magmarizer", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 109, + "y": 47, + "w": 22, + "h": 22 + } + }, + { + "filename": "protector", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 131, + "y": 47, + "w": 22, + "h": 22 + } + }, + { + "filename": "calcium", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 8, + "y": 4, + "w": 16, + "h": 24 + }, + "frame": { + "x": 153, + "y": 47, + "w": 16, + "h": 24 + } + }, + { + "filename": "thunder_stone", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 169, + "y": 68, + "w": 22, + "h": 22 + } + }, + { + "filename": "tm_bug", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 191, + "y": 69, + "w": 22, + "h": 22 + } + }, + { + "filename": "carbos", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 8, + "y": 4, + "w": 16, + "h": 24 + }, + "frame": { + "x": 213, + "y": 83, + "w": 16, + "h": 24 + } + }, + { + "filename": "tm_dark", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 43, + "y": 69, + "w": 22, + "h": 22 + } + }, + { + "filename": "tm_dragon", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 21, + "y": 71, + "w": 22, + "h": 22 + } + }, + { + "filename": "dragon_fang", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 21, + "h": 23 + }, + "frame": { + "x": 0, + "y": 73, + "w": 21, + "h": 23 + } + }, + { + "filename": "tm_electric", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 65, + "y": 69, + "w": 22, + "h": 22 + } + }, + { + "filename": "tm_fairy", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 87, + "y": 69, + "w": 22, + "h": 22 + } + }, + { + "filename": "tm_fighting", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 109, + "y": 69, + "w": 22, + "h": 22 + } + }, + { + "filename": "tm_fire", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 131, + "y": 69, + "w": 22, + "h": 22 + } + }, + { + "filename": "hp_up", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 8, + "y": 4, + "w": 16, + "h": 24 + }, + "frame": { + "x": 153, + "y": 71, + "w": 16, + "h": 24 + } + }, + { + "filename": "tm_flying", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 169, + "y": 90, + "w": 22, + "h": 22 + } + }, + { + "filename": "tm_ghost", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 191, + "y": 91, + "w": 22, + "h": 22 + } + }, + { + "filename": "iron", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 8, + "y": 4, + "w": 16, + "h": 24 + }, + "frame": { + "x": 213, + "y": 107, + "w": 16, + "h": 24 + } + }, + { + "filename": "tm_grass", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 43, + "y": 91, + "w": 22, + "h": 22 + } + }, + { + "filename": "tm_ground", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 22, + "h": 22 + }, + "frame": { + "x": 21, + "y": 93, "w": 22, "h": 22 } @@ -382,599 +1012,11 @@ }, "frame": { "x": 0, - "y": 161, + "y": 96, "w": 21, "h": 23 } }, - { - "filename": "magmarizer", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 0, - "y": 184, - "w": 22, - "h": 22 - } - }, - { - "filename": "moon_stone", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 4, - "y": 6, - "w": 23, - "h": 21 - }, - "frame": { - "x": 93, - "y": 24, - "w": 23, - "h": 21 - } - }, - { - "filename": "protector", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 157, - "y": 0, - "w": 22, - "h": 22 - } - }, - { - "filename": "dusk_stone", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, - "y": 6, - "w": 21, - "h": 21 - }, - "frame": { - "x": 179, - "y": 0, - "w": 21, - "h": 21 - } - }, - { - "filename": "deep_sea_tooth", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 6, - "w": 22, - "h": 21 - }, - "frame": { - "x": 24, - "y": 72, - "w": 22, - "h": 21 - } - }, - { - "filename": "sacred_ash", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 4, - "y": 7, - "w": 24, - "h": 20 - }, - "frame": { - "x": 22, - "y": 93, - "w": 24, - "h": 20 - } - }, - { - "filename": "thunder_stone", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 22, - "y": 113, - "w": 22, - "h": 22 - } - }, - { - "filename": "tm_bug", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 22, - "y": 135, - "w": 22, - "h": 22 - } - }, - { - "filename": "shiny_stone", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 6, - "w": 21, - "h": 21 - }, - "frame": { - "x": 179, - "y": 21, - "w": 21, - "h": 21 - } - }, - { - "filename": "dawn_stone", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, - "y": 6, - "w": 20, - "h": 21 - }, - "frame": { - "x": 116, - "y": 24, - "w": 20, - "h": 21 - } - }, - { - "filename": "tm_dark", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 136, - "y": 22, - "w": 22, - "h": 22 - } - }, - { - "filename": "zoom_lens", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 6, - "w": 21, - "h": 21 - }, - "frame": { - "x": 158, - "y": 22, - "w": 21, - "h": 21 - } - }, - { - "filename": "binding_band", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 6, - "w": 23, - "h": 20 - }, - "frame": { - "x": 22, - "y": 157, - "w": 23, - "h": 20 - } - }, - { - "filename": "tm_dragon", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 22, - "y": 177, - "w": 22, - "h": 22 - } - }, - { - "filename": "calcium", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 8, - "y": 4, - "w": 16, - "h": 24 - }, - "frame": { - "x": 44, - "y": 113, - "w": 16, - "h": 24 - } - }, - { - "filename": "deep_sea_scale", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 6, - "w": 22, - "h": 20 - }, - "frame": { - "x": 44, - "y": 137, - "w": 22, - "h": 20 - } - }, - { - "filename": "shell_bell", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 7, - "w": 23, - "h": 20 - }, - "frame": { - "x": 45, - "y": 157, - "w": 23, - "h": 20 - } - }, - { - "filename": "tm_electric", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 44, - "y": 177, - "w": 22, - "h": 22 - } - }, - { - "filename": "black_glasses", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 4, - "y": 8, - "w": 23, - "h": 17 - }, - "frame": { - "x": 47, - "y": 46, - "w": 23, - "h": 17 - } - }, - { - "filename": "tm_fairy", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 46, - "y": 63, - "w": 22, - "h": 22 - } - }, - { - "filename": "tm_fighting", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 46, - "y": 85, - "w": 22, - "h": 22 - } - }, - { - "filename": "choice_specs", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 4, - "y": 8, - "w": 24, - "h": 18 - }, - "frame": { - "x": 70, - "y": 45, - "w": 24, - "h": 18 - } - }, - { - "filename": "tm_fire", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 68, - "y": 63, - "w": 22, - "h": 22 - } - }, - { - "filename": "tm_flying", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 68, - "y": 85, - "w": 22, - "h": 22 - } - }, - { - "filename": "dragon_scale", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 4, - "y": 8, - "w": 24, - "h": 18 - }, - "frame": { - "x": 94, - "y": 45, - "w": 24, - "h": 18 - } - }, - { - "filename": "tm_ghost", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 90, - "y": 63, - "w": 22, - "h": 22 - } - }, - { - "filename": "tm_grass", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 90, - "y": 85, - "w": 22, - "h": 22 - } - }, - { - "filename": "tm_ground", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 5, - "w": 22, - "h": 22 - }, - "frame": { - "x": 60, - "y": 107, - "w": 22, - "h": 22 - } - }, { "filename": "tm_ice", "rotated": false, @@ -990,33 +1032,12 @@ "h": 22 }, "frame": { - "x": 82, - "y": 107, + "x": 65, + "y": 91, "w": 22, "h": 22 } }, - { - "filename": "dubious_disc", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 5, - "y": 7, - "w": 22, - "h": 19 - }, - "frame": { - "x": 118, - "y": 45, - "w": 22, - "h": 19 - } - }, { "filename": "tm_normal", "rotated": false, @@ -1032,8 +1053,8 @@ "h": 22 }, "frame": { - "x": 112, - "y": 64, + "x": 87, + "y": 91, "w": 22, "h": 22 } @@ -1053,33 +1074,12 @@ "h": 22 }, "frame": { - "x": 112, - "y": 86, + "x": 109, + "y": 91, "w": 22, "h": 22 } }, - { - "filename": "elixir", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 7, - "y": 4, - "w": 18, - "h": 24 - }, - "frame": { - "x": 140, - "y": 44, - "w": 18, - "h": 24 - } - }, { "filename": "tm_psychic", "rotated": false, @@ -1095,14 +1095,14 @@ "h": 22 }, "frame": { - "x": 158, - "y": 43, + "x": 131, + "y": 91, "w": 22, "h": 22 } }, { - "filename": "gb", + "filename": "pp_max", "rotated": false, "trimmed": true, "sourceSize": { @@ -1110,37 +1110,16 @@ "h": 32 }, "spriteSourceSize": { - "x": 6, - "y": 6, - "w": 20, - "h": 20 + "x": 8, + "y": 4, + "w": 16, + "h": 24 }, "frame": { - "x": 180, - "y": 42, - "w": 20, - "h": 20 - } - }, - { - "filename": "mb", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, - "y": 6, - "w": 20, - "h": 20 - }, - "frame": { - "x": 180, - "y": 62, - "w": 20, - "h": 20 + "x": 153, + "y": 95, + "w": 16, + "h": 24 } }, { @@ -1158,33 +1137,12 @@ "h": 22 }, "frame": { - "x": 158, - "y": 65, + "x": 169, + "y": 112, "w": 22, "h": 22 } }, - { - "filename": "pb", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, - "y": 6, - "w": 20, - "h": 20 - }, - "frame": { - "x": 180, - "y": 82, - "w": 20, - "h": 20 - } - }, { "filename": "tm_steel", "rotated": false, @@ -1200,12 +1158,33 @@ "h": 22 }, "frame": { - "x": 134, - "y": 68, + "x": 191, + "y": 113, "w": 22, "h": 22 } }, + { + "filename": "pp_up", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 8, + "y": 4, + "w": 16, + "h": 24 + }, + "frame": { + "x": 213, + "y": 131, + "w": 16, + "h": 24 + } + }, { "filename": "tm_water", "rotated": false, @@ -1221,8 +1200,8 @@ "h": 22 }, "frame": { - "x": 134, - "y": 90, + "x": 43, + "y": 113, "w": 22, "h": 22 } @@ -1242,14 +1221,224 @@ "h": 22 }, "frame": { - "x": 156, - "y": 87, + "x": 21, + "y": 115, "w": 22, "h": 22 } }, { - "filename": "upgrade", + "filename": "sharp_beak", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 5, + "w": 21, + "h": 23 + }, + "frame": { + "x": 0, + "y": 119, + "w": 21, + "h": 23 + } + }, + { + "filename": "moon_stone", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 6, + "w": 23, + "h": 21 + }, + "frame": { + "x": 65, + "y": 113, + "w": 23, + "h": 21 + } + }, + { + "filename": "sacred_ash", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 7, + "w": 24, + "h": 20 + }, + "frame": { + "x": 88, + "y": 113, + "w": 24, + "h": 20 + } + }, + { + "filename": "soft_sand", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 7, + "w": 24, + "h": 20 + }, + "frame": { + "x": 112, + "y": 113, + "w": 24, + "h": 20 + } + }, + { + "filename": "hyper_potion", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 8, + "y": 5, + "w": 17, + "h": 23 + }, + "frame": { + "x": 136, + "y": 113, + "w": 17, + "h": 23 + } + }, + { + "filename": "protein", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 8, + "y": 4, + "w": 16, + "h": 24 + }, + "frame": { + "x": 153, + "y": 119, + "w": 16, + "h": 24 + } + }, + { + "filename": "deep_sea_tooth", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 6, + "w": 22, + "h": 21 + }, + "frame": { + "x": 169, + "y": 134, + "w": 22, + "h": 21 + } + }, + { + "filename": "mystic_water", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 5, + "w": 20, + "h": 23 + }, + "frame": { + "x": 191, + "y": 135, + "w": 20, + "h": 23 + } + }, + { + "filename": "elixir", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 7, + "y": 4, + "w": 18, + "h": 24 + }, + "frame": { + "x": 211, + "y": 155, + "w": 18, + "h": 24 + } + }, + { + "filename": "binding_band", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 6, + "w": 23, + "h": 20 + }, + "frame": { + "x": 88, + "y": 133, + "w": 23, + "h": 20 + } + }, + { + "filename": "shell_bell", "rotated": false, "trimmed": true, "sourceSize": { @@ -1259,14 +1448,140 @@ "spriteSourceSize": { "x": 5, "y": 7, - "w": 22, - "h": 19 + "w": 23, + "h": 20 }, "frame": { - "x": 178, - "y": 102, + "x": 65, + "y": 134, + "w": 23, + "h": 20 + } + }, + { + "filename": "dusk_stone", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 6, + "w": 21, + "h": 21 + }, + "frame": { + "x": 43, + "y": 135, + "w": 21, + "h": 21 + } + }, + { + "filename": "poison_barb", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 6, + "w": 21, + "h": 21 + }, + "frame": { + "x": 21, + "y": 137, + "w": 21, + "h": 21 + } + }, + { + "filename": "shiny_stone", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 6, + "w": 21, + "h": 21 + }, + "frame": { + "x": 0, + "y": 142, + "w": 21, + "h": 21 + } + }, + { + "filename": "zoom_lens", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 6, + "w": 21, + "h": 21 + }, + "frame": { + "x": 111, + "y": 133, + "w": 21, + "h": 21 + } + }, + { + "filename": "deep_sea_scale", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 6, "w": 22, - "h": 19 + "h": 20 + }, + "frame": { + "x": 88, + "y": 153, + "w": 22, + "h": 20 + } + }, + { + "filename": "choice_specs", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 8, + "w": 24, + "h": 18 + }, + "frame": { + "x": 64, + "y": 154, + "w": 24, + "h": 18 } }, { @@ -1284,8 +1599,8 @@ "h": 24 }, "frame": { - "x": 66, - "y": 129, + "x": 42, + "y": 156, "w": 18, "h": 24 } @@ -1305,8 +1620,8 @@ "h": 24 }, "frame": { - "x": 84, - "y": 129, + "x": 21, + "y": 158, "w": 18, "h": 24 } @@ -1326,14 +1641,14 @@ "h": 24 }, "frame": { - "x": 68, - "y": 153, + "x": 0, + "y": 163, "w": 18, "h": 24 } }, { - "filename": "metal_coat", + "filename": "dragon_scale", "rotated": false, "trimmed": true, "sourceSize": { @@ -1341,121 +1656,16 @@ "h": 32 }, "spriteSourceSize": { - "x": 6, - "y": 5, - "w": 19, - "h": 22 - }, - "frame": { - "x": 66, - "y": 177, - "w": 19, - "h": 22 - } - }, - { - "filename": "carbos", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 8, - "y": 4, - "w": 16, - "h": 24 - }, - "frame": { - "x": 86, - "y": 153, - "w": 16, - "h": 24 - } - }, - { - "filename": "hyper_potion", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 8, - "y": 5, - "w": 17, - "h": 23 - }, - "frame": { - "x": 85, - "y": 177, - "w": 17, - "h": 23 - } - }, - { - "filename": "pb_gold", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, - "y": 6, - "w": 20, - "h": 20 - }, - "frame": { - "x": 104, - "y": 108, - "w": 20, - "h": 20 - } - }, - { - "filename": "everstone", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, + "x": 4, "y": 8, - "w": 20, - "h": 17 + "w": 24, + "h": 18 }, "frame": { - "x": 124, - "y": 112, - "w": 20, - "h": 17 - } - }, - { - "filename": "full_heal", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 9, - "y": 4, - "w": 15, - "h": 23 - }, - "frame": { - "x": 144, - "y": 112, - "w": 15, - "h": 23 + "x": 60, + "y": 172, + "w": 24, + "h": 18 } }, { @@ -1473,33 +1683,12 @@ "h": 24 }, "frame": { - "x": 159, - "y": 109, + "x": 39, + "y": 180, "w": 18, "h": 24 } }, - { - "filename": "razor_claw", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, - "y": 7, - "w": 20, - "h": 19 - }, - "frame": { - "x": 177, - "y": 121, - "w": 20, - "h": 19 - } - }, { "filename": "max_potion", "rotated": false, @@ -1515,75 +1704,12 @@ "h": 24 }, "frame": { - "x": 159, - "y": 133, + "x": 18, + "y": 182, "w": 18, "h": 24 } }, - { - "filename": "ub", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 6, - "y": 6, - "w": 20, - "h": 20 - }, - "frame": { - "x": 177, - "y": 140, - "w": 20, - "h": 20 - } - }, - { - "filename": "hp_up", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 8, - "y": 4, - "w": 16, - "h": 24 - }, - "frame": { - "x": 102, - "y": 129, - "w": 16, - "h": 24 - } - }, - { - "filename": "iron", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 8, - "y": 4, - "w": 16, - "h": 24 - }, - "frame": { - "x": 102, - "y": 153, - "w": 16, - "h": 24 - } - }, { "filename": "potion", "rotated": false, @@ -1599,14 +1725,14 @@ "h": 23 }, "frame": { - "x": 102, - "y": 177, + "x": 0, + "y": 187, "w": 17, "h": 23 } }, { - "filename": "pp_max", + "filename": "dawn_stone", "rotated": false, "trimmed": true, "sourceSize": { @@ -1614,58 +1740,16 @@ "h": 32 }, "spriteSourceSize": { - "x": 8, - "y": 4, - "w": 16, - "h": 24 + "x": 6, + "y": 6, + "w": 20, + "h": 21 }, "frame": { - "x": 118, - "y": 129, - "w": 16, - "h": 24 - } - }, - { - "filename": "pp_up", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 8, - "y": 4, - "w": 16, - "h": 24 - }, - "frame": { - "x": 118, - "y": 153, - "w": 16, - "h": 24 - } - }, - { - "filename": "protein", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 8, - "y": 4, - "w": 16, - "h": 24 - }, - "frame": { - "x": 119, - "y": 177, - "w": 16, - "h": 24 + "x": 132, + "y": 136, + "w": 20, + "h": 21 } }, { @@ -1683,14 +1767,56 @@ "h": 23 }, "frame": { - "x": 134, - "y": 135, + "x": 152, + "y": 143, "w": 17, "h": 23 } }, { - "filename": "oval_stone", + "filename": "dubious_disc", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, + "y": 7, + "w": 22, + "h": 19 + }, + "frame": { + "x": 169, + "y": 155, + "w": 22, + "h": 19 + } + }, + { + "filename": "metal_coat", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 5, + "w": 19, + "h": 22 + }, + "frame": { + "x": 191, + "y": 158, + "w": 19, + "h": 22 + } + }, + { + "filename": "spell_tag", "rotated": false, "trimmed": true, "sourceSize": { @@ -1699,17 +1825,59 @@ }, "spriteSourceSize": { "x": 7, + "y": 6, + "w": 19, + "h": 21 + }, + "frame": { + "x": 210, + "y": 179, + "w": 19, + "h": 21 + } + }, + { + "filename": "upgrade", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 5, "y": 7, - "w": 18, + "w": 22, "h": 19 }, "frame": { - "x": 134, - "y": 158, - "w": 18, + "x": 110, + "y": 154, + "w": 22, "h": 19 } }, + { + "filename": "gb", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 6, + "w": 20, + "h": 20 + }, + "frame": { + "x": 132, + "y": 157, + "w": 20, + "h": 20 + } + }, { "filename": "zinc", "rotated": false, @@ -1725,12 +1893,264 @@ "h": 24 }, "frame": { - "x": 135, - "y": 177, + "x": 152, + "y": 166, "w": 16, "h": 24 } }, + { + "filename": "magnet", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 6, + "w": 20, + "h": 20 + }, + "frame": { + "x": 168, + "y": 174, + "w": 20, + "h": 20 + } + }, + { + "filename": "mb", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 6, + "w": 20, + "h": 20 + }, + "frame": { + "x": 188, + "y": 180, + "w": 20, + "h": 20 + } + }, + { + "filename": "pb", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 6, + "w": 20, + "h": 20 + }, + "frame": { + "x": 84, + "y": 173, + "w": 20, + "h": 20 + } + }, + { + "filename": "pb_gold", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 6, + "w": 20, + "h": 20 + }, + "frame": { + "x": 57, + "y": 190, + "w": 20, + "h": 20 + } + }, + { + "filename": "ub", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 6, + "w": 20, + "h": 20 + }, + "frame": { + "x": 36, + "y": 204, + "w": 20, + "h": 20 + } + }, + { + "filename": "hard_stone", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 6, + "w": 19, + "h": 20 + }, + "frame": { + "x": 17, + "y": 206, + "w": 19, + "h": 20 + } + }, + { + "filename": "black_glasses", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 8, + "w": 23, + "h": 17 + }, + "frame": { + "x": 104, + "y": 173, + "w": 23, + "h": 17 + } + }, + { + "filename": "wise_glasses", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 8, + "w": 23, + "h": 17 + }, + "frame": { + "x": 127, + "y": 177, + "w": 23, + "h": 17 + } + }, + { + "filename": "metronome", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 7, + "y": 5, + "w": 17, + "h": 22 + }, + "frame": { + "x": 150, + "y": 190, + "w": 17, + "h": 22 + } + }, + { + "filename": "razor_claw", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 7, + "w": 20, + "h": 19 + }, + "frame": { + "x": 167, + "y": 194, + "w": 20, + "h": 19 + } + }, + { + "filename": "miracle_seed", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 6, + "y": 7, + "w": 19, + "h": 19 + }, + "frame": { + "x": 104, + "y": 190, + "w": 19, + "h": 19 + } + }, + { + "filename": "silver_powder", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 4, + "y": 11, + "w": 24, + "h": 15 + }, + "frame": { + "x": 123, + "y": 194, + "w": 24, + "h": 15 + } + }, { "filename": "razor_fang", "rotated": false, @@ -1746,12 +2166,33 @@ "h": 20 }, "frame": { - "x": 152, - "y": 157, + "x": 77, + "y": 193, "w": 18, "h": 20 } }, + { + "filename": "oval_stone", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 32, + "h": 32 + }, + "spriteSourceSize": { + "x": 7, + "y": 7, + "w": 18, + "h": 19 + }, + "frame": { + "x": 56, + "y": 210, + "w": 18, + "h": 19 + } + }, { "filename": "golden_egg", "rotated": false, @@ -1767,8 +2208,8 @@ "h": 20 }, "frame": { - "x": 151, - "y": 177, + "x": 95, + "y": 209, "w": 17, "h": 20 } @@ -1788,14 +2229,14 @@ "h": 20 }, "frame": { - "x": 170, - "y": 160, + "x": 112, + "y": 209, "w": 17, "h": 20 } }, { - "filename": "prism_scale", + "filename": "everstone", "rotated": false, "trimmed": true, "sourceSize": { @@ -1803,36 +2244,15 @@ "h": 32 }, "spriteSourceSize": { - "x": 9, + "x": 6, "y": 8, - "w": 15, - "h": 15 - }, - "frame": { - "x": 168, - "y": 180, - "w": 15, - "h": 15 - } - }, - { - "filename": "revive", - "rotated": false, - "trimmed": true, - "sourceSize": { - "w": 32, - "h": 32 - }, - "spriteSourceSize": { - "x": 10, - "y": 8, - "w": 12, + "w": 20, "h": 17 }, "frame": { - "x": 187, - "y": 160, - "w": 12, + "x": 129, + "y": 209, + "w": 20, "h": 17 } } @@ -1842,6 +2262,6 @@ "meta": { "app": "https://www.codeandweb.com/texturepacker", "version": "3.0", - "smartupdate": "$TexturePacker:SmartUpdate:a1f518d9e1139553a9c9fe056f7c0328:d09d41adca58aa2c39234c6ca54e35ee:110e074689c9edd2c54833ce2e4d9270$" + "smartupdate": "$TexturePacker:SmartUpdate:ca7cdcfb7349d9ec8808e68c4d81012a:b87049b08a6be17ff53c8bfbe63513db:110e074689c9edd2c54833ce2e4d9270$" } } diff --git a/public/images/items.png b/public/images/items.png index a78812ac7..8c5750cd0 100644 Binary files a/public/images/items.png and b/public/images/items.png differ diff --git a/public/images/items/black_belt.png b/public/images/items/black_belt.png new file mode 100644 index 000000000..70d130978 Binary files /dev/null and b/public/images/items/black_belt.png differ diff --git a/public/images/items/charcoal.png b/public/images/items/charcoal.png new file mode 100644 index 000000000..4d2511773 Binary files /dev/null and b/public/images/items/charcoal.png differ diff --git a/public/images/items/clefairy_doll.png b/public/images/items/clefairy_doll.png new file mode 100644 index 000000000..8e1691ddd Binary files /dev/null and b/public/images/items/clefairy_doll.png differ diff --git a/public/images/items/dragon_fang.png b/public/images/items/dragon_fang.png new file mode 100644 index 000000000..33659e503 Binary files /dev/null and b/public/images/items/dragon_fang.png differ diff --git a/public/images/items/hard_stone.png b/public/images/items/hard_stone.png new file mode 100644 index 000000000..604b44f99 Binary files /dev/null and b/public/images/items/hard_stone.png differ diff --git a/public/images/items/linking_cord.png b/public/images/items/linking_cord.png new file mode 100644 index 000000000..0cdadd29f Binary files /dev/null and b/public/images/items/linking_cord.png differ diff --git a/public/images/items/magnet.png b/public/images/items/magnet.png new file mode 100644 index 000000000..7a07f557e Binary files /dev/null and b/public/images/items/magnet.png differ diff --git a/public/images/items/metronome.png b/public/images/items/metronome.png new file mode 100644 index 000000000..dfde7e365 Binary files /dev/null and b/public/images/items/metronome.png differ diff --git a/public/images/items/miracle_seed.png b/public/images/items/miracle_seed.png new file mode 100644 index 000000000..f5bc76654 Binary files /dev/null and b/public/images/items/miracle_seed.png differ diff --git a/public/images/items/muscle_band.png b/public/images/items/muscle_band.png new file mode 100644 index 000000000..011716e71 Binary files /dev/null and b/public/images/items/muscle_band.png differ diff --git a/public/images/items/mystic_water.png b/public/images/items/mystic_water.png new file mode 100644 index 000000000..f944fac1a Binary files /dev/null and b/public/images/items/mystic_water.png differ diff --git a/public/images/items/never_melt_ice.png b/public/images/items/never_melt_ice.png new file mode 100644 index 000000000..bec7cc0e5 Binary files /dev/null and b/public/images/items/never_melt_ice.png differ diff --git a/public/images/items/poison_barb.png b/public/images/items/poison_barb.png new file mode 100644 index 000000000..913ede4d8 Binary files /dev/null and b/public/images/items/poison_barb.png differ diff --git a/public/images/items/sharp_beak.png b/public/images/items/sharp_beak.png new file mode 100644 index 000000000..3ce8d83e3 Binary files /dev/null and b/public/images/items/sharp_beak.png differ diff --git a/public/images/items/silk_scarf.png b/public/images/items/silk_scarf.png new file mode 100644 index 000000000..2eaea7aa4 Binary files /dev/null and b/public/images/items/silk_scarf.png differ diff --git a/public/images/items/silver_powder.png b/public/images/items/silver_powder.png new file mode 100644 index 000000000..03f62b452 Binary files /dev/null and b/public/images/items/silver_powder.png differ diff --git a/public/images/items/soft_sand.png b/public/images/items/soft_sand.png new file mode 100644 index 000000000..c627bc10a Binary files /dev/null and b/public/images/items/soft_sand.png differ diff --git a/public/images/items/spell_tag.png b/public/images/items/spell_tag.png new file mode 100644 index 000000000..ccf071e12 Binary files /dev/null and b/public/images/items/spell_tag.png differ diff --git a/public/images/items/twisted_spoon.png b/public/images/items/twisted_spoon.png new file mode 100644 index 000000000..54a96de7d Binary files /dev/null and b/public/images/items/twisted_spoon.png differ diff --git a/public/images/items/wise_glasses.png b/public/images/items/wise_glasses.png new file mode 100644 index 000000000..49a95761a Binary files /dev/null and b/public/images/items/wise_glasses.png differ diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 8664969c7..8e5e6222c 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -5,7 +5,7 @@ import { EncounterPhase, SummonPhase, CommandPhase, NextEncounterPhase, SwitchBi import { PlayerPokemon, EnemyPokemon } from './pokemon'; import PokemonSpecies, { allSpecies, getPokemonSpecies } from './pokemon-species'; import * as Utils from './utils'; -import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PartyShareModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ConsumablePokemonMoveModifier } from './modifier'; +import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PartyShareModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ConsumablePokemonMoveModifier, ModifierPredicate } from './modifier'; import { PokeballType } from './pokeball'; import { Species } from './species'; import { initAutoPlay } from './auto-play'; @@ -279,7 +279,7 @@ export default class BattleScene extends Phaser.Scene { let loadPokemonAssets = []; const isRandom = this.isButtonPressed(Button.RANDOM); // For testing purposes - this.quickStart = isRandom || this.isButtonPressed(Button.QUICK_START); + this.quickStart = this.quickStart || isRandom || this.isButtonPressed(Button.QUICK_START); if (isRandom) { const biomes = Utils.getEnumValues(Biome); @@ -617,6 +617,10 @@ export default class BattleScene extends Phaser.Scene { return this.modifiers.find(m => m instanceof modifierType); } + findModifier(modifierFilter: ModifierPredicate): Modifier { + return this.modifiers.find(m => (modifierFilter as ModifierPredicate)(m)); + } + applyModifiers(modifierType: { new(...args: any[]): Modifier }, ...args: any[]): void { const modifiers = this.modifiers.filter(m => m instanceof modifierType && m.shouldApply(args)); for (let modifier of modifiers) { diff --git a/src/biome.ts b/src/biome.ts index 688b6738f..8a53c239f 100644 --- a/src/biome.ts +++ b/src/biome.ts @@ -187,6 +187,22 @@ export class BiomeArena { return Biome[this.biomeType].toLowerCase(); } + isDaytime() { + switch (this.biomeType) { + case Biome.PLAINS: + case Biome.GRASS: + case Biome.SEA: + case Biome.BEACH: + case Biome.LAKE: + case Biome.MOUNTAIN: + case Biome.LAND: + case Biome.DESERT: + case Biome.MEADOW: + case Biome.DOJO: + return true; + } + } + preloadBgm(): void { this.scene.loadBgm(this.bgm); } diff --git a/src/main.ts b/src/main.ts index 86d6e9050..d991cc360 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,7 +15,7 @@ const config: Phaser.Types.Core.GameConfig = { scene: [ BattleScene ] }; -const setPositionRelative = function(guideObject: any, x: number, y: number) { +const setPositionRelative = function (guideObject: any, x: number, y: number) { if (guideObject && guideObject.hasOwnProperty('width') && guideObject.hasOwnProperty('height')) { const offsetX = guideObject.width * (-0.5 + (0.5 - guideObject.originX)); const offsetY = guideObject.height * (-0.5 + (0.5 - guideObject.originY)); diff --git a/src/modifier-type.ts b/src/modifier-type.ts index 7b2fccae0..b47353fa5 100644 --- a/src/modifier-type.ts +++ b/src/modifier-type.ts @@ -1,7 +1,8 @@ import * as Modifiers from './modifier'; -import { Moves, allMoves } from './move'; +import { AttackMove, Moves, allMoves } from './move'; import { PokeballType, getPokeballName } from './pokeball'; import { PlayerPokemon, PokemonMove } from './pokemon'; +import { EvolutionItem, pokemonEvolutions } from './pokemon-evolutions'; import { Stat, getStatName } from './pokemon-stat'; import { tmSpecies } from './tms'; import { Type } from './type'; @@ -137,6 +138,61 @@ export class PokemonAllMovePpRestoreModifierType extends PokemonModifierType { } } +function getAttackTypeBoosterItemName(type: Type) { + switch (type) { + case Type.NORMAL: + return 'Silk Scarf'; + case Type.FIGHTING: + return 'Black Belt'; + case Type.FLYING: + return 'Sharp Beak'; + case Type.POISON: + return 'Poison Barb'; + case Type.GROUND: + return 'Soft Sand'; + case Type.ROCK: + return 'Hard Stone'; + case Type.BUG: + return 'Silver Powder'; + case Type.GHOST: + return 'Spell Tag'; + case Type.STEEL: + return 'Metal Coat'; + case Type.FIRE: + return 'Charcoal'; + case Type.WATER: + return 'Mystic Water'; + case Type.GRASS: + return 'Miracle Seed'; + case Type.ELECTRIC: + return 'Magnet'; + case Type.PSYCHIC: + return 'Twisted Spoon'; + case Type.ICE: + return 'Never-Melt Ice' + case Type.DRAGON: + return 'Dragon Fang'; + case Type.DARK: + return 'Black Glasses'; + case Type.FAIRY: + return 'Clefairy Doll'; + } +} + +export class AttackTypeBoosterModifierType extends PokemonModifierType { + public moveType: Type; + public boostPercent: integer; + + constructor(moveType: Type, boostPercent: integer) { + super(getAttackTypeBoosterItemName(moveType), `Inceases the power of a POKéMON's ${Type[moveType]}-type moves by 20%`, + (_type, args) => new Modifiers.AttackTypeBoosterModifier(this, (args[0] as PlayerPokemon).id, moveType, boostPercent), + null, `${getAttackTypeBoosterItemName(moveType).replace(/[ \-]/g, '_').toLowerCase()}`); + + this.moveType = moveType; + this.boostPercent = boostPercent; + } +} + export class PokemonLevelIncrementModifierType extends PokemonModifierType { constructor(name: string, iconImage?: string) { super(name, `Increase a POKéMON\'s level by 1`, (_type, args) => new Modifiers.PokemonLevelIncrementModifier(this, (args[0] as PlayerPokemon).id), @@ -187,6 +243,50 @@ export class TmModifierType extends PokemonModifierType { } } +function getEvolutionItemName(evolutionItem: EvolutionItem) { + switch (evolutionItem) { + case EvolutionItem.LINKING_CORD: + return 'Linking Cord'; + case EvolutionItem.SUN_STONE: + return 'Sun Stone'; + case EvolutionItem.MOON_STONE: + return 'Moon Stone'; + case EvolutionItem.LEAF_STONE: + return 'Leaf Stone'; + case EvolutionItem.FIRE_STONE: + return 'Fire Stone'; + case EvolutionItem.WATER_STONE: + return 'Water Stone'; + case EvolutionItem.THUNDER_STONE: + return 'Thunder Stone'; + case EvolutionItem.ICE_STONE: + return 'Ice Stone'; + case EvolutionItem.DUSK_STONE: + return 'Dusk Stone'; + case EvolutionItem.DAWN_STONE: + return 'Dawn Stone'; + case EvolutionItem.SHINY_STONE: + return 'Shiny Stone'; + } +} + +export class EvolutionItemModifierType extends PokemonModifierType { + public evolutionItem: EvolutionItem; + + constructor(evolutionItem: EvolutionItem) { + super(getEvolutionItemName(evolutionItem), `Causes certain POKéMON to evolve`, (_type, args) => new Modifiers.EvolutionItemModifier(this, (args[0] as PlayerPokemon).id), + (pokemon: PlayerPokemon) => { + if (pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId) && pokemonEvolutions[pokemon.species.speciesId].filter(e => e.item === this.evolutionItem + && (!e.condition || e.condition.predicate(pokemon))).length) + return null; + + return PartyUiHandler.NoEffectMessage; + }, getEvolutionItemName(evolutionItem).replace(/[ \-]/g, '_').toLowerCase()); + + this.evolutionItem = evolutionItem; + } +} + class ModifierTypeGenerator extends ModifierType { private genTypeFunc: Function; @@ -197,11 +297,69 @@ class ModifierTypeGenerator extends ModifierType { generateType(party: PlayerPokemon[]) { const ret = this.genTypeFunc(party); - ret.setTier(this.tier); + if (ret) { + console.log(ret); + ret.setTier(this.tier); + } return ret; } } +class AttackTypeBoosterModifierTypeGenerator extends ModifierTypeGenerator { + constructor() { + super((party: PlayerPokemon[]) => { + const attackMoveTypes = party.map(p => p.moveset.map(m => m.getMove()).filter(m => m instanceof AttackMove).map(m => m.type)).flat(); + const attackMoveTypeWeights = new Map(); + let totalWeight = 0; + for (let t of attackMoveTypes) { + if (attackMoveTypeWeights.has(t)) { + if (attackMoveTypeWeights.get(t) < 3) + attackMoveTypeWeights.set(t, attackMoveTypeWeights.get(t) + 1); + else + continue; + } else + attackMoveTypeWeights.set(t, 1); + totalWeight++; + } + + if (!totalWeight) + return null; + + let type: Type; + + const randInt = Utils.randInt(totalWeight); + let weight = 0; + + for (let t of attackMoveTypeWeights.keys()) { + const typeWeight = attackMoveTypeWeights.get(t); + if (randInt <= weight + typeWeight) { + type = t; + break; + } + weight += typeWeight; + } + + return new AttackTypeBoosterModifierType(type, 20); + }); + } +} + +class EvolutionItemModifierTypeGenerator extends ModifierTypeGenerator { + constructor() { + super((party: PlayerPokemon[]) => { + const evolutionItemPool = party.filter(p => pokemonEvolutions.hasOwnProperty(p.species.speciesId)).map(p => { + const evolutions = pokemonEvolutions[p.species.speciesId] + return evolutions.filter(e => e.item !== EvolutionItem.NONE && (!e.condition || e.condition.predicate(p))); + }).flat().flatMap(e => e.item); + + if (!evolutionItemPool.length) + return null; + + return new EvolutionItemModifierType(evolutionItemPool[Utils.randInt(evolutionItemPool.length)]); + }); + } +} + class WeightedModifierType { public modifierType: ModifierType; public weight: integer | Function; @@ -237,56 +395,58 @@ const modifierPool = { }) ].map(m => { m.setTier(ModifierTier.COMMON); return m; }), [ModifierTier.GREAT]: [ - new WeightedModifierType(new AddPokeballModifierType(PokeballType.GREAT_BALL, 5, 'gb'), 3), + new WeightedModifierType(new AddPokeballModifierType(PokeballType.GREAT_BALL, 5, 'gb'), 12), new WeightedModifierType(new PokemonReviveModifierType('REVIVE', 50), (party: PlayerPokemon[]) => { const faintedPartyMemberCount = party.filter(p => !p.hp).length; - return faintedPartyMemberCount * 3; + return faintedPartyMemberCount * 6; }), new WeightedModifierType(new PokemonReviveModifierType('MAX REVIVE', 100), (party: PlayerPokemon[]) => { const faintedPartyMemberCount = party.filter(p => !p.hp).length; - return faintedPartyMemberCount; + return faintedPartyMemberCount * 2; + }), + new WeightedModifierType(new AllPokemonFullReviveModifierType('SACRED ASH'), (party: PlayerPokemon[]) => { + return party.filter(p => !p.hp).length >= Math.ceil(party.length / 2) ? 1 : 0; }), new WeightedModifierType(new PokemonHpRestoreModifierType('HYPER POTION', 200), (party: PlayerPokemon[]) => { const thresholdPartyMemberCount = party.filter(p => p.getInverseHp() >= 100 || p.getHpRatio() <= 0.625).length; - return thresholdPartyMemberCount; + return thresholdPartyMemberCount * 2; }), new WeightedModifierType(new PokemonHpRestoreModifierType('MAX POTION', 100, true), (party: PlayerPokemon[]) => { const thresholdPartyMemberCount = party.filter(p => p.getInverseHp() >= 150 || p.getHpRatio() <= 0.5).length; - return Math.ceil(thresholdPartyMemberCount / 3); + return Math.ceil(thresholdPartyMemberCount / 1.5); }), new WeightedModifierType(new PokemonAllMovePpRestoreModifierType('ELIXIR', 10), (party: PlayerPokemon[]) => { const thresholdPartyMemberCount = party.filter(p => p.moveset.filter(m => m.ppUsed >= 5).length).length; - return thresholdPartyMemberCount; + return thresholdPartyMemberCount * 2; }), new WeightedModifierType(new PokemonAllMovePpRestoreModifierType('MAX ELIXIR', -1), (party: PlayerPokemon[]) => { const thresholdPartyMemberCount = party.filter(p => p.moveset.filter(m => m.ppUsed > 10).length).length; - return Math.ceil(thresholdPartyMemberCount / 3); + return Math.ceil(thresholdPartyMemberCount / 1.5); }), new WeightedModifierType(new ModifierTypeGenerator((party: PlayerPokemon[]) => { const partyMemberCompatibleTms = party.map(p => p.compatibleTms); const uniqueCompatibleTms = partyMemberCompatibleTms.flat().filter((tm, i, array) => array.indexOf(tm) === i); const randTmIndex = Utils.randInt(uniqueCompatibleTms.length); return new TmModifierType(uniqueCompatibleTms[randTmIndex]); - }), 2), - new PokemonLevelIncrementModifierType('RARE CANDY'), - new PokemonBaseStatBoosterModifierType('HP-UP', Stat.HP), - new PokemonBaseStatBoosterModifierType('PROTEIN', Stat.ATK), - new PokemonBaseStatBoosterModifierType('IRON', Stat.DEF), - new PokemonBaseStatBoosterModifierType('CALCIUM', Stat.SPATK), - new PokemonBaseStatBoosterModifierType('ZINC', Stat.SPDEF), - new PokemonBaseStatBoosterModifierType('CARBOS', Stat.SPD) + }), 4), + new WeightedModifierType(new PokemonLevelIncrementModifierType('RARE CANDY'), 4), + new WeightedModifierType(new PokemonBaseStatBoosterModifierType('HP-UP', Stat.HP), 1), + new WeightedModifierType(new PokemonBaseStatBoosterModifierType('PROTEIN', Stat.ATK), 1), + new WeightedModifierType(new PokemonBaseStatBoosterModifierType('IRON', Stat.DEF), 1), + new WeightedModifierType(new PokemonBaseStatBoosterModifierType('CALCIUM', Stat.SPATK), 1), + new WeightedModifierType(new PokemonBaseStatBoosterModifierType('ZINC', Stat.SPDEF), 1), + new WeightedModifierType(new PokemonBaseStatBoosterModifierType('CARBOS', Stat.SPD), 1) ].map(m => { m.setTier(ModifierTier.GREAT); return m; }), [ModifierTier.ULTRA]: [ - new AddPokeballModifierType(PokeballType.ULTRA_BALL, 5, 'ub'), - new WeightedModifierType(new AllPokemonFullReviveModifierType('SACRED ASH'), (party: PlayerPokemon[]) => { - return party.filter(p => !p.hp).length >= Math.ceil(party.length / 2) ? 1 : 0; - }), + new WeightedModifierType(new AddPokeballModifierType(PokeballType.ULTRA_BALL, 5, 'ub'), 8), + new WeightedModifierType(new EvolutionItemModifierTypeGenerator(), 5), + new WeightedModifierType(new AttackTypeBoosterModifierTypeGenerator(), 3), new ModifierType('OVAL CHARM', 'For every X (no. of party members) items in a POKéMON\'s held item stack, give one to each other party member', (type, _args) => new Modifiers.PartyShareModifier(type), 'oval_charm'), new ModifierType('HEALING CHARM', 'Doubles the effectiveness of HP restoring moves and items (excludes revives)', (type, _args) => new Modifiers.HealingBoosterModifier(type, 2), 'healing_charm'), - new WeightedModifierType(new PokemonModifierType('SHELL BELL', 'Heals 1/8 of a POKéMON\'s damage dealt', (type, args) => new Modifiers.HitHealModifier(type, (args[0] as PlayerPokemon).id)), 8), - new ExpBoosterModifierType('LUCKY EGG', 25), - new ModifierType('EXP. SHARE', 'All POKéMON in your party gain an additional 10% of a battle\'s EXP. Points', (type, _args) => new Modifiers.ExpShareModifier(type), 'exp_share') + new WeightedModifierType(new PokemonModifierType('SHELL BELL', 'Heals 1/8 of a POKéMON\'s dealt damage', (type, args) => new Modifiers.HitHealModifier(type, (args[0] as PlayerPokemon).id)), 8), + new WeightedModifierType(new ExpBoosterModifierType('LUCKY EGG', 25), 4), + new WeightedModifierType(new ModifierType('EXP. SHARE', 'All POKéMON in your party gain an additional 10% of a battle\'s EXP. Points', (type, _args) => new Modifiers.ExpShareModifier(type), 'exp_share'), 3) ].map(m => { m.setTier(ModifierTier.ULTRA); return m; }), [ModifierTier.MASTER]: [ new AddPokeballModifierType(PokeballType.MASTER_BALL, 1, 'mb'), @@ -335,10 +495,12 @@ export function getModifierTypeOptionsForWave(waveIndex: integer, count: integer return new Array(count).fill(0).map(() => getNewModifierTypeOption(party)); } -function getNewModifierTypeOption(party: PlayerPokemon[]): ModifierTypeOption { +function getNewModifierTypeOption(party: PlayerPokemon[], tier?: ModifierTier, upgrade?: boolean): ModifierTypeOption { const tierValue = Utils.randInt(256); - const upgrade = Utils.randInt(32) === 0; - const tier: ModifierTier = (tierValue >= 52 ? ModifierTier.COMMON : tierValue >= 8 ? ModifierTier.GREAT : tierValue >= 1 ? ModifierTier.ULTRA : ModifierTier.MASTER) + (upgrade ? 1 : 0); + if (tier === undefined) { + tier = (tierValue >= 52 ? ModifierTier.COMMON : tierValue >= 8 ? ModifierTier.GREAT : tierValue >= 1 ? ModifierTier.ULTRA : ModifierTier.MASTER) + (upgrade ? 1 : 0); + upgrade = Utils.randInt(32) === 0; + } const thresholds = Object.keys(modifierPoolThresholds[tier]); const totalWeight = parseInt(thresholds[thresholds.length - 1]); const value = Utils.randInt(totalWeight); @@ -354,8 +516,14 @@ function getNewModifierTypeOption(party: PlayerPokemon[]): ModifierTypeOption { let modifierType: ModifierType | WeightedModifierType = modifierPool[tier][index]; if (modifierType instanceof WeightedModifierType) modifierType = (modifierType as WeightedModifierType).modifierType; - if (modifierType instanceof ModifierTypeGenerator) + if (modifierType instanceof ModifierTypeGenerator) { modifierType = (modifierType as ModifierTypeGenerator).generateType(party); + if (modifierType === null) { + console.log(ModifierTier[tier], upgrade); + return getNewModifierTypeOption(party, tier, upgrade); + } + } + console.log(modifierType); return new ModifierTypeOption(modifierType as ModifierType, upgrade); } diff --git a/src/modifier.ts b/src/modifier.ts index 6ab1acd85..6faef5421 100644 --- a/src/modifier.ts +++ b/src/modifier.ts @@ -1,5 +1,5 @@ import * as ModifierTypes from './modifier-type'; -import { CommonAnimPhase, LearnMovePhase, LevelUpPhase, MessagePhase, PokemonHealPhase } from "./battle-phases"; +import { LearnMovePhase, LevelUpPhase, MessagePhase, PokemonHealPhase } from "./battle-phases"; import BattleScene from "./battle-scene"; import { getLevelTotalExp } from "./exp"; import { PokeballType } from "./pokeball"; @@ -7,9 +7,12 @@ import Pokemon, { PlayerPokemon } from "./pokemon"; import { Stat } from "./pokemon-stat"; import { addTextObject, TextStyle } from "./text"; import * as Utils from "./utils"; -import { CommonAnim } from './battle-anims'; +import { Type } from './type'; +import { EvolutionPhase } from './evolution-phase'; +import { pokemonEvolutions } from './pokemon-evolutions'; type ModifierType = ModifierTypes.ModifierType; +export type ModifierPredicate = (modifier: Modifier) => boolean; export class ModifierBar extends Phaser.GameObjects.Container { constructor(scene: BattleScene) { @@ -253,6 +256,36 @@ export class PokemonBaseStatModifier extends PokemonHeldItemModifier { } } +export class AttackTypeBoosterModifier extends PokemonHeldItemModifier { + private moveType: Type; + private boostMultiplier: number; + + constructor(type: ModifierType, pokemonId: integer, moveType: Type, boostPercent: integer) { + super(type, pokemonId); + + this.moveType = moveType; + this.boostMultiplier = boostPercent * 0.01; + } + + match(modifier: Modifier) { + return modifier instanceof AttackTypeBoosterModifier; + } + + clone() { + return new AttackTypeBoosterModifier(this.type, this.pokemonId, this.moveType, this.boostMultiplier * 100); + } + + shouldApply(args: any[]): boolean { + return super.shouldApply(args) && args.length === 2 && args[1] instanceof Utils.NumberHolder; + } + + apply(args: any[]): boolean { + (args[1] as Utils.NumberHolder).value = Math.floor((args[1] as Utils.NumberHolder).value * (1 + (this.getStackCount() * this.boostMultiplier))); + + return true; + } +} + export class HitHealModifier extends PokemonHeldItemModifier { constructor(type: ModifierType, pokemonId: integer) { super(type, pokemonId); @@ -270,7 +303,7 @@ export class HitHealModifier extends PokemonHeldItemModifier { const pokemon = args[0] as PlayerPokemon; if (pokemon.turnData.damageDealt && pokemon.getHpRatio() < 1) { - const scene = pokemon.scene as BattleScene; + const scene = pokemon.scene; const hpRestoreMultiplier = new Utils.IntegerHolder(1); scene.applyModifiers(HealingBoosterModifier, hpRestoreMultiplier); @@ -388,8 +421,7 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier { pokemon.exp = getLevelTotalExp(pokemon.level, pokemon.species.growthRate); pokemon.levelExp = 0; - const scene = pokemon.scene as BattleScene; - scene.unshiftPhase(new LevelUpPhase(scene, scene.getParty().indexOf(pokemon), pokemon.level - 1, pokemon.level)); + pokemon.scene.unshiftPhase(new LevelUpPhase(pokemon.scene, pokemon.scene.getParty().indexOf(pokemon), pokemon.level - 1, pokemon.level)); return true; } @@ -403,13 +435,32 @@ export class TmModifier extends ConsumablePokemonModifier { apply(args: any[]): boolean { const pokemon = args[0] as PlayerPokemon; - const scene = pokemon.scene as BattleScene; - scene.unshiftPhase(new LearnMovePhase(scene, scene.getParty().indexOf(pokemon), (this.type as ModifierTypes.TmModifierType).moveId)); + pokemon.scene.unshiftPhase(new LearnMovePhase(pokemon.scene, pokemon.scene.getParty().indexOf(pokemon), (this.type as ModifierTypes.TmModifierType).moveId)); return true; } } +export class EvolutionItemModifier extends ConsumablePokemonModifier { + constructor(type: ModifierTypes.EvolutionItemModifierType, pokemonId: integer) { + super(type, pokemonId); + } + + apply(args: any[]): boolean { + const pokemon = args[0] as PlayerPokemon; + + const matchingEvolution = pokemonEvolutions[pokemon.species.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem + && (!e.condition || e.condition.predicate(pokemon))); + + if (matchingEvolution) { + pokemon.scene.unshiftPhase(new EvolutionPhase(pokemon.scene, pokemon.scene.getParty().indexOf(pokemon), matchingEvolution, pokemon.level - 1)); + return true; + } + + return false; + } +} + export class PartyShareModifier extends PersistentModifier { constructor(type: ModifierType) { super(type); diff --git a/src/pokemon-evolutions.ts b/src/pokemon-evolutions.ts index 73c305a2a..6ab5ae950 100644 --- a/src/pokemon-evolutions.ts +++ b/src/pokemon-evolutions.ts @@ -1,6 +1,13 @@ +import { Biome } from "./biome"; +import { AttackTypeBoosterModifier } from "./modifier"; +import { AttackTypeBoosterModifierType } from "./modifier-type"; +import { Moves } from "./move"; +import { PokeballType } from "./pokeball"; import Pokemon from "./pokemon"; import { Stat } from "./pokemon-stat"; import { Species } from "./species"; +import { Type } from "./type"; +import * as Utils from "./utils"; export enum SpeciesWildEvolutionDelay { NONE, @@ -10,17 +17,32 @@ export enum SpeciesWildEvolutionDelay { VERY_LONG } +export enum EvolutionItem { + NONE, + LINKING_CORD, + SUN_STONE, + MOON_STONE, + LEAF_STONE, + FIRE_STONE, + WATER_STONE, + THUNDER_STONE, + ICE_STONE, + DUSK_STONE, + DAWN_STONE, + SHINY_STONE +} + export class SpeciesEvolution { public speciesId: Species; public level: integer; - public item: string; - public condition: SpeciesEvolutionCondition | string; + public item: EvolutionItem; + public condition: SpeciesEvolutionCondition; public wildDelay: SpeciesWildEvolutionDelay; - constructor(speciesId: Species, level: integer, item: string, condition: SpeciesEvolutionCondition | string, wildDelay?: SpeciesWildEvolutionDelay) { + constructor(speciesId: Species, level: integer, item: EvolutionItem, condition: SpeciesEvolutionCondition, wildDelay?: SpeciesWildEvolutionDelay) { this.speciesId = speciesId; this.level = level; - this.item = item; + this.item = item || EvolutionItem.NONE; this.condition = condition; this.wildDelay = wildDelay || SpeciesWildEvolutionDelay.NONE; } @@ -142,7 +164,7 @@ export const pokemonEvolutions: PokemonEvolutions = { ], [Species.SLOWPOKE]: [ new SpeciesEvolution(Species.SLOWBRO, 37, null, null), - new SpeciesEvolution(Species.SLOWKING, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* King's rock*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.SLOWKING, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* King's rock*/), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.MAGNEMITE]: [ new SpeciesEvolution(Species.MAGNETON, 30, null, null) @@ -324,8 +346,8 @@ export const pokemonEvolutions: PokemonEvolutions = { new SpeciesEvolution(Species.LINOONE, 20, null, null) ], [Species.WURMPLE]: [ - new SpeciesEvolution(Species.SILCOON, 7, null, 'random based on personality'), - new SpeciesEvolution(Species.CASCOON, 7, null, 'random based on personality') + new SpeciesEvolution(Species.SILCOON, 7, null, new SpeciesEvolutionCondition((p: Pokemon) => Utils.randInt(2) === 0, true)), // TODO: Improve these conditions + new SpeciesEvolution(Species.CASCOON, 7, null, new SpeciesEvolutionCondition((p: Pokemon) => Utils.randInt(2) === 0, true)) ], [Species.SILCOON]: [ new SpeciesEvolution(Species.BEAUTIFLY, 10, null, null) @@ -350,7 +372,7 @@ export const pokemonEvolutions: PokemonEvolutions = { ], [Species.KIRLIA]: [ new SpeciesEvolution(Species.GARDEVOIR, 30, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender, true)), - new SpeciesEvolution(Species.GALLADE, 1, "Dawn Stone", new SpeciesEvolutionCondition((p: Pokemon) => p.gender, true), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.GALLADE, 1, EvolutionItem.DAWN_STONE, new SpeciesEvolutionCondition((p: Pokemon) => p.gender, true), SpeciesWildEvolutionDelay.LONG) ], [Species.SURSKIT]: [ new SpeciesEvolution(Species.MASQUERAIN, 22, null, null) @@ -366,7 +388,7 @@ export const pokemonEvolutions: PokemonEvolutions = { ], [Species.NINCADA]: [ new SpeciesEvolution(Species.NINJASK, 20, null, null), - new SpeciesEvolution(Species.SHEDINJA, 20, null, 'empty spot in party, Pokéball in bag') + new SpeciesEvolution(Species.SHEDINJA, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.getParty().length < 6 && p.scene.pokeballCounts[PokeballType.POKEBALL], true)) ], [Species.WHISMUR]: [ new SpeciesEvolution(Species.LOUDRED, 20, null, null) @@ -439,7 +461,7 @@ export const pokemonEvolutions: PokemonEvolutions = { ], [Species.SNORUNT]: [ new SpeciesEvolution(Species.GLALIE, 42, null, null), - new SpeciesEvolution(Species.FROSLASS, 1, "Dawn Stone", new SpeciesEvolutionCondition((p: Pokemon) => !p.gender, true), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.FROSLASS, 1, EvolutionItem.DAWN_STONE, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender, true), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.SPHEAL]: [ new SpeciesEvolution(Species.SEALEO, 32, null, null) @@ -503,9 +525,9 @@ export const pokemonEvolutions: PokemonEvolutions = { ], [Species.BURMY]: [ new SpeciesEvolution(Species.MOTHIM, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => p.gender, true)), - new SpeciesEvolution(Species.WORMADAM, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender/* && grass*/, true)), - new SpeciesEvolution(Species.WORMADAM, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender/* && cave*/, true)), - new SpeciesEvolution(Species.WORMADAM, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender/* && building*/, true)) + new SpeciesEvolution(Species.WORMADAM, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender && p.scene.arena.biomeType === Biome.FOREST, true)), + new SpeciesEvolution(Species.WORMADAM, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender && p.scene.arena.biomeType === Biome.CAVE, true)), + new SpeciesEvolution(Species.WORMADAM, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender && p.scene.arena.biomeType === Biome.CITY, true)) ], [Species.COMBEE]: [ new SpeciesEvolution(Species.VESPIQUEN, 21, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.gender, true)) @@ -730,199 +752,203 @@ export const pokemonEvolutions: PokemonEvolutions = { new SpeciesEvolution(Species.VOLCARONA, 59, null, null) ], [Species.PIKACHU]: [ - new SpeciesEvolution(Species.RAICHU, 1, "Thunder Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.RAICHU, 1, EvolutionItem.THUNDER_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.NIDORINA]: [ - new SpeciesEvolution(Species.NIDOQUEEN, 1, "Moon Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.NIDOQUEEN, 1, EvolutionItem.MOON_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.NIDORINO]: [ - new SpeciesEvolution(Species.NIDOKING, 1, "Moon Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.NIDOKING, 1, EvolutionItem.MOON_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.CLEFAIRY]: [ - new SpeciesEvolution(Species.CLEFABLE, 1, "Moon Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.CLEFABLE, 1, EvolutionItem.MOON_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.VULPIX]: [ - new SpeciesEvolution(Species.NINETALES, 1, "Fire Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.NINETALES, 1, EvolutionItem.FIRE_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.JIGGLYPUFF]: [ - new SpeciesEvolution(Species.WIGGLYTUFF, 1, "Moon Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.WIGGLYTUFF, 1, EvolutionItem.MOON_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.GLOOM]: [ - new SpeciesEvolution(Species.VILEPLUME, 1, "Leaf Stone", null, SpeciesWildEvolutionDelay.LONG), - new SpeciesEvolution(Species.BELLOSSOM, 1, "Sun Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.VILEPLUME, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.LONG), + new SpeciesEvolution(Species.BELLOSSOM, 1, EvolutionItem.SUN_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.GROWLITHE]: [ - new SpeciesEvolution(Species.ARCANINE, 1, "Fire Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.ARCANINE, 1, EvolutionItem.FIRE_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.POLIWHIRL]: [ - new SpeciesEvolution(Species.POLIWRATH, 1, "Water Stone", null, SpeciesWildEvolutionDelay.LONG), - new SpeciesEvolution(Species.POLITOED, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* King's rock*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.POLIWRATH, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.LONG), + new SpeciesEvolution(Species.POLITOED, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* King's rock*/), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.WEEPINBELL]: [ - new SpeciesEvolution(Species.VICTREEBEL, 1, "Leaf Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.VICTREEBEL, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.MAGNETON]: [ - new SpeciesEvolution(Species.MAGNEZONE, 1, "Thunder Stone", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.MAGNEZONE, 1, EvolutionItem.THUNDER_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.SHELLDER]: [ - new SpeciesEvolution(Species.CLOYSTER, 1, "Water Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.CLOYSTER, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.EXEGGCUTE]: [ - new SpeciesEvolution(Species.EXEGGUTOR, 1, "Leaf Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.EXEGGUTOR, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.TANGELA]: [ - new SpeciesEvolution(Species.TANGROWTH, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Ancient power learned*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.TANGROWTH, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.ANCIENT_POWER).length), SpeciesWildEvolutionDelay.LONG) ], [Species.LICKITUNG]: [ - new SpeciesEvolution(Species.LICKILICKY, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Rollout learned*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.LICKILICKY, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.ROLLOUT).length), SpeciesWildEvolutionDelay.LONG) ], [Species.STARYU]: [ - new SpeciesEvolution(Species.STARMIE, 1, "Water Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.STARMIE, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.EEVEE]: [ - new SpeciesEvolution(Species.ESPEON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10 /* daytime */), SpeciesWildEvolutionDelay.MEDIUM), - new SpeciesEvolution(Species.UMBREON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10 /* nighttime */), SpeciesWildEvolutionDelay.MEDIUM), - new SpeciesEvolution(Species.VAPOREON, 1, "Water Stone", null, SpeciesWildEvolutionDelay.MEDIUM), - new SpeciesEvolution(Species.JOLTEON, 1, "Thunder Stone", null, SpeciesWildEvolutionDelay.MEDIUM), - new SpeciesEvolution(Species.FLAREON, 1, "Fire Stone", null, SpeciesWildEvolutionDelay.MEDIUM), - new SpeciesEvolution(Species.LEAFEON, 1, "Leaf Stone", null, SpeciesWildEvolutionDelay.MEDIUM), - new SpeciesEvolution(Species.GLACEON, 1, "Ice Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.ESPEON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10 && p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM), + new SpeciesEvolution(Species.UMBREON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10 && !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM), + new SpeciesEvolution(Species.VAPOREON, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM), + new SpeciesEvolution(Species.JOLTEON, 1, EvolutionItem.THUNDER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM), + new SpeciesEvolution(Species.FLAREON, 1, EvolutionItem.FIRE_STONE, null, SpeciesWildEvolutionDelay.MEDIUM), + new SpeciesEvolution(Species.LEAFEON, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.MEDIUM), + new SpeciesEvolution(Species.GLACEON, 1, EvolutionItem.ICE_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.TOGETIC]: [ - new SpeciesEvolution(Species.TOGEKISS, 1, "Shiny Stone", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.TOGEKISS, 1, EvolutionItem.SHINY_STONE, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.AIPOM]: [ - new SpeciesEvolution(Species.AMBIPOM, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Double hit learned*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.AMBIPOM, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.DOUBLE_HIT).length), SpeciesWildEvolutionDelay.LONG) ], [Species.SUNKERN]: [ - new SpeciesEvolution(Species.SUNFLORA, 1, "Sun Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.SUNFLORA, 1, EvolutionItem.SUN_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.YANMA]: [ - new SpeciesEvolution(Species.YANMEGA, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Rollout learned*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.YANMEGA, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.ROLLOUT).length), SpeciesWildEvolutionDelay.LONG) ], [Species.MURKROW]: [ - new SpeciesEvolution(Species.HONCHKROW, 1, "Dusk Stone", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.HONCHKROW, 1, EvolutionItem.DUSK_STONE, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.MISDREAVUS]: [ - new SpeciesEvolution(Species.MISMAGIUS, 1, "Dusk Stone", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.MISMAGIUS, 1, EvolutionItem.DUSK_STONE, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.GLIGAR]: [ - new SpeciesEvolution(Species.GLISCOR, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Razor fang at night*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.GLISCOR, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime() /* Razor fang at night*/), SpeciesWildEvolutionDelay.LONG) ], [Species.SNEASEL]: [ - new SpeciesEvolution(Species.WEAVILE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Razor claw at night*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.WEAVILE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime() /* Razor claw at night*/), SpeciesWildEvolutionDelay.LONG) ], [Species.PILOSWINE]: [ - new SpeciesEvolution(Species.MAMOSWINE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Ancient power learned*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.MAMOSWINE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.ANCIENT_POWER).length), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.LOMBRE]: [ - new SpeciesEvolution(Species.LUDICOLO, 1, "Water Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.LUDICOLO, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.NUZLEAF]: [ - new SpeciesEvolution(Species.SHIFTRY, 1, "Leaf Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.SHIFTRY, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.NOSEPASS]: [ - new SpeciesEvolution(Species.PROBOPASS, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Magnetic field??*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.PROBOPASS, 1, EvolutionItem.THUNDER_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.SKITTY]: [ - new SpeciesEvolution(Species.DELCATTY, 1, "Moon Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.DELCATTY, 1, EvolutionItem.MOON_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.ROSELIA]: [ - new SpeciesEvolution(Species.ROSERADE, 1, "Shiny Stone", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.ROSERADE, 1, EvolutionItem.SHINY_STONE, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.BONSLY]: [ - new SpeciesEvolution(Species.SUDOWOODO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Mimic learned */), SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.SUDOWOODO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.MIMIC).length), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.MIME_JR]: [ - new SpeciesEvolution(Species.MR_MIME, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Mimic learned */), SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.MR_MIME, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.MIMIC).length), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.MANTYKE]: [ - new SpeciesEvolution(Species.MANTINE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => true /* Remoraid in party */), SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.MANTINE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.getParty().find(p => p.species.speciesId === Species.REMORAID)), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.PANSAGE]: [ - new SpeciesEvolution(Species.SIMISAGE, 1, "Leaf Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.SIMISAGE, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.PANSEAR]: [ - new SpeciesEvolution(Species.SIMISEAR, 1, "Fire Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.SIMISEAR, 1, EvolutionItem.FIRE_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.PANPOUR]: [ - new SpeciesEvolution(Species.SIMIPOUR, 1, "Water Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.SIMIPOUR, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.MUNNA]: [ - new SpeciesEvolution(Species.MUSHARNA, 1, "Moon Stone", null, SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.MUSHARNA, 1, EvolutionItem.MOON_STONE, null, SpeciesWildEvolutionDelay.LONG) ], [Species.COTTONEE]: [ - new SpeciesEvolution(Species.WHIMSICOTT, 1, "Sun Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.WHIMSICOTT, 1, EvolutionItem.SUN_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.PETILIL]: [ - new SpeciesEvolution(Species.LILLIGANT, 1, "Sun Stone", null, SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.LILLIGANT, 1, EvolutionItem.SUN_STONE, null, SpeciesWildEvolutionDelay.MEDIUM) ], [Species.MINCCINO]: [ - new SpeciesEvolution(Species.CINCCINO, 1, "Shiny Stone", null, SpeciesWildEvolutionDelay.SHORT) + new SpeciesEvolution(Species.CINCCINO, 1, EvolutionItem.SHINY_STONE, null, SpeciesWildEvolutionDelay.SHORT) ], [Species.EELEKTRIK]: [ - new SpeciesEvolution(Species.EELEKTROSS, 1, "Thunder Stone", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.EELEKTROSS, 1, EvolutionItem.THUNDER_STONE, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.LAMPENT]: [ - new SpeciesEvolution(Species.CHANDELURE, 1, "Dusk Stone", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.CHANDELURE, 1, EvolutionItem.DUSK_STONE, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.KADABRA]: [ - new SpeciesEvolution(Species.ALAKAZAM, 1, "Link Cable", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.ALAKAZAM, 1, EvolutionItem.LINKING_CORD, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.MACHOKE]: [ - new SpeciesEvolution(Species.MACHAMP, 1, "Link Cable", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.MACHAMP, 1, EvolutionItem.LINKING_CORD, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.GRAVELER]: [ - new SpeciesEvolution(Species.GOLEM, 1, "Link Cable", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.GOLEM, 1, EvolutionItem.LINKING_CORD, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.HAUNTER]: [ - new SpeciesEvolution(Species.GENGAR, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.GENGAR, 1, EvolutionItem.LINKING_CORD, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.ONIX]: [ - new SpeciesEvolution(Species.STEELIX, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Metal coat*/ ), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.STEELIX, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition( + (p: Pokemon) => p.scene.findModifier(m => m instanceof AttackTypeBoosterModifier && (m.type as AttackTypeBoosterModifierType).moveType === Type.STEEL)), + SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.RHYDON]: [ - new SpeciesEvolution(Species.RHYPERIOR, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Protector */), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.RHYPERIOR, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Protector */), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.SEADRA]: [ - new SpeciesEvolution(Species.KINGDRA, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Dragon scale*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.KINGDRA, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Dragon scale*/), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.SCYTHER]: [ - new SpeciesEvolution(Species.SCIZOR, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Metal coat*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.SCIZOR, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition( + (p: Pokemon) => p.scene.findModifier(m => m instanceof AttackTypeBoosterModifier && (m.type as AttackTypeBoosterModifierType).moveType === Type.STEEL) ), + SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.ELECTABUZZ]: [ - new SpeciesEvolution(Species.ELECTIVIRE, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Electirizer*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.ELECTIVIRE, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Electirizer*/), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.MAGMAR]: [ - new SpeciesEvolution(Species.MAGMORTAR, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Magmarizer*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.MAGMORTAR, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Magmarizer*/), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.PORYGON]: [ - new SpeciesEvolution(Species.PORYGON2, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /*Upgrade*/), SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.PORYGON2, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /*Upgrade*/), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.PORYGON2]: [ - new SpeciesEvolution(Species.PORYGON_Z, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Dubious disc*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.PORYGON_Z, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Dubious disc*/), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.FEEBAS]: [ - new SpeciesEvolution(Species.MILOTIC, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Prism scale*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.MILOTIC, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Prism scale*/), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.DUSCLOPS]: [ - new SpeciesEvolution(Species.DUSKNOIR, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Reaper cloth*/), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.DUSKNOIR, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Reaper cloth*/), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.CLAMPERL]: [ - new SpeciesEvolution(Species.HUNTAIL, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Deep sea tooth*/), SpeciesWildEvolutionDelay.MEDIUM), - new SpeciesEvolution(Species.GOREBYSS, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Deep sea scale*/), SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.HUNTAIL, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Deep sea tooth*/), SpeciesWildEvolutionDelay.MEDIUM), + new SpeciesEvolution(Species.GOREBYSS, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => true /* Deep sea scale*/), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.BOLDORE]: [ - new SpeciesEvolution(Species.GIGALITH, 1, "Link Cable", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.GIGALITH, 1, EvolutionItem.LINKING_CORD, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.GURDURR]: [ - new SpeciesEvolution(Species.CONKELDURR, 1, "Link Cable", null, SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesEvolution(Species.CONKELDURR, 1, EvolutionItem.LINKING_CORD, null, SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.KARRABLAST]: [ - new SpeciesEvolution(Species.ESCAVALIER, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Trade with shelmet??*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.ESCAVALIER, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.getParty().find(p => p.species.speciesId === Species.SHELMET)), SpeciesWildEvolutionDelay.LONG) ], [Species.SHELMET]: [ - new SpeciesEvolution(Species.ACCELGOR, 1, "Link Cable", new SpeciesEvolutionCondition((p: Pokemon) => true /* Trade with karrablast??*/), SpeciesWildEvolutionDelay.LONG) + new SpeciesEvolution(Species.ACCELGOR, 1, EvolutionItem.LINKING_CORD, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.getParty().find(p => p.species.speciesId === Species.KARRABLAST)), SpeciesWildEvolutionDelay.LONG) ], [Species.PICHU]: [ new SpeciesEvolution(Species.PIKACHU, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10), SpeciesWildEvolutionDelay.SHORT) @@ -949,16 +975,16 @@ export const pokemonEvolutions: PokemonEvolutions = { new SpeciesEvolution(Species.MARILL, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10), SpeciesWildEvolutionDelay.SHORT) ], [Species.BUDEW]: [ - new SpeciesEvolution(Species.ROSELIA, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount > 10 /* daytime */), SpeciesWildEvolutionDelay.SHORT) + new SpeciesEvolution(Species.ROSELIA, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount > 10 && p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.SHORT) ], [Species.CHINGLING]: [ - new SpeciesEvolution(Species.CHIMECHO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10 /* nighttime */), SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.CHIMECHO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10 && !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.BUNEARY]: [ new SpeciesEvolution(Species.LOPUNNY, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.RIOLU]: [ - new SpeciesEvolution(Species.LUCARIO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10 /* daytime */), SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.LUCARIO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10 && p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.WOOBAT]: [ new SpeciesEvolution(Species.SWOOBAT, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.winCount >= 10), SpeciesWildEvolutionDelay.MEDIUM) diff --git a/src/pokemon.ts b/src/pokemon.ts index 65c78f137..2cfe24aa6 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -8,7 +8,7 @@ import * as Utils from './utils'; import { Type, getTypeDamageMultiplier } from './type'; import { getLevelTotalExp } from './exp'; import { Stat } from './pokemon-stat'; -import { PokemonBaseStatModifier as PokemonBaseStatBoosterModifier, ShinyRateBoosterModifier } from './modifier'; +import { AttackTypeBoosterModifier, PokemonBaseStatModifier as PokemonBaseStatBoosterModifier, ShinyRateBoosterModifier } from './modifier'; import { PokeballType } from './pokeball'; import { Gender } from './gender'; import { initMoveAnim, loadMoveAnimAssets } from './battle-anims'; @@ -18,6 +18,7 @@ import { pokemonEvolutions, SpeciesEvolution, SpeciesEvolutionCondition } from ' import { MessagePhase } from './battle-phases'; import { BattleStat } from './battle-stat'; import { BattleTag, BattleTagLapseType, BattleTagType } from './battle-tag'; +import { Species } from './species'; export default abstract class Pokemon extends Phaser.GameObjects.Container { public id: integer; @@ -95,11 +96,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const rand1 = Utils.binToDec(Utils.decToBin(this.id).substring(0, 16)); const rand2 = Utils.binToDec(Utils.decToBin(this.id).substring(16, 32)); - const E = (this.scene as BattleScene).trainerId ^ (this.scene as BattleScene).secretId; + const E = this.scene.trainerId ^ this.scene.secretId; const F = rand1 ^ rand2; let shinyThreshold = new Utils.IntegerHolder(32); - (this.scene as BattleScene).applyModifiers(ShinyRateBoosterModifier, shinyThreshold); + this.scene.applyModifiers(ShinyRateBoosterModifier, shinyThreshold); console.log(shinyThreshold.value); this.shiny = (E ^ F) < shinyThreshold.value; @@ -113,11 +114,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.winCount = 0; } - //this.setPipeline((this.scene as BattleScene).spritePipeline); + //this.setPipeline(this.scene).spritePipeline); this.calculateStats(); - (scene as BattleScene).fieldUI.addAt(this.battleInfo, 0); + scene.fieldUI.addAt(this.battleInfo, 0); this.battleInfo.initInfo(this); @@ -163,10 +164,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const moveIds = this.moveset.map(m => m.getMove().id); Promise.allSettled(moveIds.map(m => initMoveAnim(m))) .then(() => { - loadMoveAnimAssets(this.scene as BattleScene, moveIds); - this.species.loadAssets(this.scene as BattleScene, this.gender === Gender.FEMALE); + loadMoveAnimAssets(this.scene, moveIds); + this.species.loadAssets(this.scene, this.gender === Gender.FEMALE); if (this.isPlayer()) - (this.scene as BattleScene).loadAtlas(this.getBattleSpriteKey(), 'pokemon', this.getBattleSpriteAtlasPath()); + this.scene.loadAtlas(this.getBattleSpriteKey(), 'pokemon', this.getBattleSpriteAtlasPath()); this.scene.load.once(Phaser.Loader.Events.COMPLETE, () => { if (this.isPlayer()) { const originalWarn = console.warn; @@ -260,7 +261,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.stats = [ 0, 0, 0, 0, 0, 0 ]; const baseStats = this.species.baseStats.slice(0); console.log(this.id); - (this.scene as BattleScene).applyModifiers(PokemonBaseStatBoosterModifier, this, baseStats); + this.scene.applyModifiers(PokemonBaseStatBoosterModifier, this, baseStats); const stats = Utils.getEnumValues(Stat); for (let s of stats) { const isHp = s === Stat.HP; @@ -412,7 +413,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { apply(source: Pokemon, battlerMove: PokemonMove): Promise { return new Promise(resolve => { - const battleScene = this.scene as BattleScene; let result: MoveResult = MoveResult.STATUS; let success = false; const move = battlerMove.getMove(); @@ -422,15 +422,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { case MoveCategory.PHYSICAL: case MoveCategory.SPECIAL: const isPhysical = moveCategory === MoveCategory.PHYSICAL; + const power = new Utils.NumberHolder(move.power); + this.scene.applyModifiers(AttackTypeBoosterModifier, source, power); const critChance = new Utils.IntegerHolder(16); - applyMoveAttrs(HighCritAttr, this.scene as BattleScene, source, this, move, critChance); + applyMoveAttrs(HighCritAttr, this.scene, source, this, move, critChance); const isCritical = Utils.randInt(critChance.value) === 0; const sourceAtk = source.getBattleStat(isPhysical ? Stat.ATK : Stat.SPATK); const targetDef = this.getBattleStat(isPhysical ? Stat.DEF : Stat.SPDEF); const stabMultiplier = source.species.type1 === move.type || (source.species.type2 > -1 && source.species.type2 === move.type) ? 1.5 : 1; const typeMultiplier = getTypeDamageMultiplier(move.type, this.species.type1) * (this.species.type2 > -1 ? getTypeDamageMultiplier(move.type, this.species.type2) : 1); const criticalMultiplier = isCritical ? 2 : 1; - damage = Math.ceil(((((2 * source.level / 5 + 2) * move.power * sourceAtk / targetDef) / 50) + 2) * stabMultiplier * typeMultiplier * ((Utils.randInt(15) + 85) / 100)) * criticalMultiplier; + damage = Math.ceil(((((2 * source.level / 5 + 2) * power.value * sourceAtk / targetDef) / 50) + 2) * stabMultiplier * typeMultiplier * ((Utils.randInt(15) + 85) / 100)) * criticalMultiplier; if (isPhysical && source.status && source.status.effect === StatusEffect.BURN) damage = Math.floor(damage / 2); move.getAttrs(HitsTagAttr).map(hta => hta as HitsTagAttr).filter(hta => hta.doubleDamage).forEach(hta => { @@ -444,7 +446,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.hp = Math.max(this.hp - damage, 0); source.turnData.damageDealt += damage; if (isCritical) - battleScene.unshiftPhase(new MessagePhase(battleScene, 'A critical hit!')); + this.scene.unshiftPhase(new MessagePhase(this.scene, 'A critical hit!')); } if (typeMultiplier >= 2) result = MoveResult.SUPER_EFFECTIVE; @@ -462,16 +464,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { break; case MoveResult.SUPER_EFFECTIVE: this.scene.sound.play('hit_strong'); - battleScene.unshiftPhase(new MessagePhase(battleScene, 'It\'s super effective!')); + this.scene.unshiftPhase(new MessagePhase(this.scene, 'It\'s super effective!')); success = true; break; case MoveResult.NOT_VERY_EFFECTIVE: this.scene.sound.play('hit_weak'); - battleScene.unshiftPhase(new MessagePhase(battleScene, 'It\'s not very effective!')) + this.scene.unshiftPhase(new MessagePhase(this.scene, 'It\'s not very effective!')) success = true; break; case MoveResult.NO_EFFECT: - battleScene.unshiftPhase(new MessagePhase(battleScene, `It doesn\'t affect ${this.name}!`)) + this.scene.unshiftPhase(new MessagePhase(this.scene, `It doesn\'t affect ${this.name}!`)) success = true; break; } @@ -546,7 +548,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } cry(soundConfig?: Phaser.Types.Sound.SoundConfig): integer { - return this.species.cry(this.scene as BattleScene, soundConfig); + return this.species.cry(this.scene, soundConfig); } faintCry(callback: Function) { @@ -724,6 +726,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } } +export default interface Pokemon { + scene: BattleScene +} + export class PlayerPokemon extends Pokemon { public compatibleTms: Moves[]; @@ -760,9 +766,10 @@ export class PlayerPokemon extends Pokemon { evolve(evolution: SpeciesEvolution): Promise { return new Promise(resolve => { + this.handleSpecialEvolutions(evolution); this.species = getPokemonSpecies(evolution.speciesId); this.name = this.species.name.toUpperCase(); - this.species.generateIconAnim(this.scene as BattleScene); + this.species.generateIconAnim(this.scene); this.compatibleTms.splice(0, this.compatibleTms.length); this.generateCompatibleTms(); this.loadAssets().then(() => { @@ -771,6 +778,17 @@ export class PlayerPokemon extends Pokemon { }); }); } + + private handleSpecialEvolutions(evolution: SpeciesEvolution) { + if (this.species.speciesId === Species.NINCADA && evolution.speciesId === Species.NINJASK) { + const newEvolution = pokemonEvolutions[this.species.speciesId][1]; + if (newEvolution.condition.predicate(this)) { + const newPokemon = new PlayerPokemon(this.scene, this.species, this.level); + this.scene.getParty().push(newPokemon); + newPokemon.evolve(newEvolution); + } + } + } } export class EnemyPokemon extends Pokemon { @@ -798,7 +816,7 @@ export class EnemyPokemon extends Pokemon { return movePool[Utils.randInt(movePool.length)]; case AiType.SMART_RANDOM: case AiType.SMART: - const target = (this.scene as BattleScene).getPlayerPokemon(); + const target = this.scene.getPlayerPokemon(); const moveScores = movePool.map(() => 0); for (let m in movePool) { const pokemonMove = movePool[m]; @@ -868,11 +886,11 @@ export class EnemyPokemon extends Pokemon { } addToParty() { - const party = (this.scene as BattleScene).getParty(); + const party = this.scene.getParty(); let ret: PlayerPokemon = null; if (party.length < 6) { - const newPokemon = new PlayerPokemon(this.scene as BattleScene, this.species, this.level, this); + const newPokemon = new PlayerPokemon(this.scene, this.species, this.level, this); party.push(newPokemon); ret = newPokemon; } diff --git a/src/ui/command-ui-handler.ts b/src/ui/command-ui-handler.ts index f9ada8aec..d39c3cb0b 100644 --- a/src/ui/command-ui-handler.ts +++ b/src/ui/command-ui-handler.ts @@ -43,7 +43,7 @@ export default class CommandUiHandler extends UiHandler { const messageHandler = this.getUi().getMessageHandler(); messageHandler.bg.setTexture('bg_command'); messageHandler.message.setWordWrapWidth(1110); - messageHandler.showText(`What will\n${(this.scene as BattleScene).getPlayerPokemon().name} do?`, 0); + messageHandler.showText(`What will\n${this.scene.getPlayerPokemon().name} do?`, 0); this.setCursor(this.cursor); } diff --git a/src/ui/fight-ui-handler.ts b/src/ui/fight-ui-handler.ts index 712116d0e..20d51f37c 100644 --- a/src/ui/fight-ui-handler.ts +++ b/src/ui/fight-ui-handler.ts @@ -49,7 +49,7 @@ export default class FightUiHandler extends UiHandler { if (button === Button.CANCEL || button === Button.ACTION) { if (button === Button.ACTION) { - if (((this.scene as BattleScene).getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, this.cursor)) + if ((this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, this.cursor)) success = true; else ui.playError(); @@ -91,7 +91,7 @@ export default class FightUiHandler extends UiHandler { ui.add(this.cursorObj); } - const moveset = (this.scene as BattleScene).getPlayerPokemon().moveset; + const moveset = this.scene.getPlayerPokemon().moveset; const hasMove = cursor < moveset.length; @@ -114,7 +114,7 @@ export default class FightUiHandler extends UiHandler { } displayMoves() { - const moveset = (this.scene as BattleScene).getPlayerPokemon().moveset; + const moveset = this.scene.getPlayerPokemon().moveset; for (let m = 0; m < 4; m++) { const moveText = addTextObject(this.scene, m % 2 === 0 ? 0 : 100, m < 2 ? 0 : 16, '-', TextStyle.WINDOW); if (m < moveset.length) diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 6875d3a95..919422184 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -280,7 +280,7 @@ export default class PartyUiHandler extends MessageUiHandler { } populatePartySlots() { - const party = (this.scene as BattleScene).getParty(); + const party = this.scene.getParty(); if (this.cursor < 6 && this.cursor >= party.length) this.cursor = party.length - 1; @@ -289,7 +289,7 @@ export default class PartyUiHandler extends MessageUiHandler { for (let p in party) { const slotIndex = parseInt(p); - const partySlot = new PartySlot(this.scene as BattleScene, slotIndex, party[p]); + const partySlot = new PartySlot(this.scene, slotIndex, party[p]); this.scene.add.existing(partySlot); this.partySlotsContainer.add(partySlot); this.partySlots.push(partySlot);