MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / castPlayerEraseMagic

Method castPlayerEraseMagic

code/main/Quest.ts:237–255  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

235 }
236
237 public castPlayerEraseMagic(): void{
238 // Will be true if at least one spell was erased
239 var magicErased: boolean = false;
240
241 // Set dead to all the spells
242 for(var i = 0; i < this.getEntities().length; i++){
243 if(this.getEntities()[i].getIsASpell()){
244 this.getEntities()[i].setDead(true);
245 magicErased = true;
246 }
247 }
248
249 // If some spell was erase, we successfully casted the spell
250 if(magicErased)
251 this.getGame().getQuestLog().addMessage(new QuestLogMessage("You cast an erase magic spell!"));
252 // Else, it didn't work
253 else
254 this.getGame().getQuestLog().addMessage(new QuestLogMessage("You failed to cast an erase magic spell : there's no magic to erase."));
255 }
256
257 public castPlayerFireball(movement: Pos = new Pos(2, 0)): void{
258 // Create the fireball

Callers

nothing calls this directly

Calls 6

getEntitiesMethod · 0.95
getIsASpellMethod · 0.80
setDeadMethod · 0.80
addMessageMethod · 0.80
getQuestLogMethod · 0.80
getGameMethod · 0.45

Tested by

no test coverage detected