()
| 827 | } |
| 828 | |
| 829 | private createPlayerSpells(): void{ |
| 830 | // Add the spells |
| 831 | if(Saving.loadBool("gridItemPossessedBeginnersGrimoire")){ |
| 832 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellAcidRainButton", new Pos(0, 0), "Acid rain", new Color(ColorType.QUEST_BUTTON_ACID_RAIN), new CallbackCollection(this.castPlayerAcidRain.bind(this)), QuestPlayerSpellCountdownType.SPELLS, this.getMagicCountdownTime(), 0, "a")); |
| 833 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellFireballButton", new Pos(11, 0), "Fireball", new Color(ColorType.QUEST_BUTTON_FIREBALL), new CallbackCollection(this.castPlayerFireball.bind(this)), QuestPlayerSpellCountdownType.SPELLS, this.getMagicCountdownTime(), 0, "f")); |
| 834 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellTeleportButton", new Pos(21, 0), "Teleport", new Color(ColorType.QUEST_BUTTON_TELEPORT), new CallbackCollection(this.castPlayerTeleport.bind(this)), QuestPlayerSpellCountdownType.SPELLS, this.getMagicCountdownTime(), 0, "t")); |
| 835 | } |
| 836 | if(Saving.loadBool("gridItemPossessedAdvancedGrimoire")){ |
| 837 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellEraseMagicButton", new Pos(33, 0), "Erase magic", new Color(ColorType.QUEST_BUTTON_ERASE_MAGIC), new CallbackCollection(this.castPlayerEraseMagic.bind(this)), QuestPlayerSpellCountdownType.SPELLS, this.getMagicCountdownTime(), 0, "e")); |
| 838 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellThornsShieldButton", new Pos(46, 0), "Thorns shield", new Color(ColorType.QUEST_BUTTON_THORNS_SHIELD), new CallbackCollection(this.castPlayerThornsShield.bind(this)), QuestPlayerSpellCountdownType.SPELLS, this.getMagicCountdownTime(), 6, " ")); |
| 839 | } |
| 840 | if(Saving.loadBool("gridItemPossessedBlackMagicGrimoire")){ |
| 841 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellObsidianWallButton", new Pos(63, 0), "Obsidian wall", new Color(ColorType.QUEST_BUTTON_OBSIDIAN_WALL), new CallbackCollection(this.castPlayerObsidianWall.bind(this)), QuestPlayerSpellCountdownType.SPELLS, this.getMagicCountdownTime(), 0, "o")); |
| 842 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellBlackDemonsButton", new Pos(78, 0), "Black demons", new Color(ColorType.QUEST_BUTTON_BLACK_DEMONS), new CallbackCollection(this.castPlayerBlackDemons.bind(this)), QuestPlayerSpellCountdownType.SPELLS, this.getMagicCountdownTime(), 6, "d")); |
| 843 | } |
| 844 | |
| 845 | // Add the potions |
| 846 | if(Saving.loadBool("questPlayerSpellHealthPotionHasSpell")) |
| 847 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellHealthPotionButton", new Pos(0, 2), "Health", new Color(ColorType.QUEST_BUTTON_HEALTH_POTION), new CallbackCollection(this.castPlayerHealthPotion.bind(this)), QuestPlayerSpellCountdownType.POTIONS, this.getMagicCountdownTime(), 0, "h", "questPlayerSpellHealthPotionQuantity")); |
| 848 | if(Saving.loadBool("questPlayerSpellTurtlePotionHasSpell")) |
| 849 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellTurtlePotionButton", new Pos(13, 2), "Turtle", new Color(ColorType.QUEST_BUTTON_TURTLE_POTION), new CallbackCollection(this.castPlayerTurtlePotion.bind(this)), QuestPlayerSpellCountdownType.POTIONS, this.getMagicCountdownTime(), 2, "r", "questPlayerSpellTurtlePotionQuantity")); |
| 850 | if(Saving.loadBool("questPlayerSpellAntiGravityPotionHasSpell")) |
| 851 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellAntiGravityPotionButton", new Pos(26, 2), "Anti gravity", new Color(ColorType.QUEST_BUTTON_ANTI_GRAVITY_POTION), new CallbackCollection(this.castPlayerAntiGravityPotion.bind(this)), QuestPlayerSpellCountdownType.POTIONS, this.getMagicCountdownTime(), 5, "g", "questPlayerSpellAntiGravityPotionQuantity")); |
| 852 | if(Saving.loadBool("questPlayerSpellBerserkPotionHasSpell")) |
| 853 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellBerserkPotionButton", new Pos(45, 2), "Berserk", new Color(ColorType.QUEST_BUTTON_BERSERK_POTION), new CallbackCollection(this.castPlayerBerserkPotion.bind(this)), QuestPlayerSpellCountdownType.POTIONS, this.getMagicCountdownTime(), 0, "b", "questPlayerSpellBerserkPotionQuantity")); |
| 854 | if(Saving.loadBool("questPlayerSpellCloningPotionHasSpell")) |
| 855 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellCloningPotionButton", new Pos(59, 2), "Cloning", new Color(ColorType.QUEST_BUTTON_CLONING_POTION), new CallbackCollection(this.castPlayerCloningPotion.bind(this)), QuestPlayerSpellCountdownType.POTIONS, this.getMagicCountdownTime(), 0, "c", "questPlayerSpellCloningPotionQuantity")); |
| 856 | if(Saving.loadBool("questPlayerSpellPPotionHasSpell")) |
| 857 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellPPotionButton", new Pos(73, 2), "P", new Color(ColorType.QUEST_BUTTON_P_POTION), new CallbackCollection(this.castPlayerPPotion.bind(this)), QuestPlayerSpellCountdownType.POTIONS, this.getMagicCountdownTime(), 0, "p", "questPlayerSpellPPotionQuantity")); |
| 858 | if(Saving.loadBool("questPlayerSpellXPotionHasSpell")) |
| 859 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellXPotionButton", new Pos(81, 2), "X", new Color(ColorType.QUEST_BUTTON_X_POTION), new CallbackCollection(this.castPlayerXPotion.bind(this)), QuestPlayerSpellCountdownType.POTIONS, this.getMagicCountdownTime(), 0, "x", "questPlayerSpellXPotionQuantity")); |
| 860 | |
| 861 | // Add the capacities granted by objects |
| 862 | if(Saving.loadBool("gridItemPossessedTimeRing")) |
| 863 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellTimeSlowingButton", new Pos(0, 4), "Time slowing", new Color(ColorType.QUEST_BUTTON_SOME_OBJECT), new CallbackCollection(this.castPlayerTimeSlowing.bind(this)), QuestPlayerSpellCountdownType.ITEM_CAPACITIES, 0, 8, "w")); |
| 864 | if(Saving.loadBool("gridItemPossessedPogoStick")) |
| 865 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellJumpButton", new Pos(14, 4), "Jump", new Color(ColorType.QUEST_BUTTON_SOME_OBJECT), new CallbackCollection(this.castPlayerJump.bind(this)), QuestPlayerSpellCountdownType.ITEM_CAPACITIES, 0, 0, "j")); |
| 866 | if(Saving.loadBool("gridItemPossessedSponge")) |
| 867 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpellSqueezeButton", new Pos(20, 4), "Squeeze", new Color(ColorType.QUEST_BUTTON_SOME_OBJECT), new CallbackCollection(this.castPlayerSqueeze.bind(this)), QuestPlayerSpellCountdownType.ITEM_CAPACITIES, 0, 0, "s")); |
| 868 | |
| 869 | // Add the special spell granted by the purple shark fin |
| 870 | if(Saving.loadBool("gridItemPossessedPurpleSharkFin")) |
| 871 | this.addPlayerSpell(new QuestPlayerSpell(this, "questPlayerSpell", new Pos(38, 4), "Black hole spell (purple shark fin) (once per quest)", new Color(ColorType.QUEST_BLACKHOLE_SPELL), new CallbackCollection(this.castPlayerBlackhole.bind(this)), QuestPlayerSpellCountdownType.BLACKHOLE, 1, 4, "k")); |
| 872 | |
| 873 | // Set the player spells height from the max height found in all the spells added |
| 874 | this.playerSpellsHeight = 0; |
| 875 | for(var i = 0; i < this.playerSpells.length; i++){ |
| 876 | if(this.playerSpells[i].getButtonPosition().y > this.playerSpellsHeight) |
| 877 | this.playerSpellsHeight = this.playerSpells[i].getButtonPosition().y; |
| 878 | } |
| 879 | this.playerSpellsHeight += 1; // Add one because for example if the highest spell is at 0 we need a 1 height |
| 880 | this.playerSpellsHeight += 1; // Add one to make a clear separation with the real quest |
| 881 | } |
| 882 | |
| 883 | private drawPlayerSpells(): void{ |
| 884 | // If there's at least one player spell |
no test coverage detected