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

Method castSpell

code/main/MonkeyWizard.ts:144–167  ·  view source on GitHub ↗
(stored: boolean)

Source from the content-addressed store, hash-verified

142
143 // Private methods
144 private castSpell(stored: boolean): void{
145 var ball: MonkeyWizardMagicalPurpleBall = new MonkeyWizardMagicalPurpleBall(this.getQuest(),
146 this.getGlobalPosition().plus(new Pos(3, 0)),
147 new Naming("An magical purple ball", "a magical purple ball"),
148 (stored? new Color(ColorType.MONKEY_WIZARD_BALL_STORED) : new Color(ColorType.MONKEY_WIZARD_BALL)),
149 new Pos(2, 1),
150 15,
151 this.getAndPossiblyCreateSpellCastingDamageReason(new Naming("An magical purple ball", "a magical purple ball")),
152 (stored? 350 - this.bigTimer : null)
153 );
154
155 // If we're not going to be stored
156 if(stored == false){
157 // Target the player
158 ball.setTargetTypeTargetEntity(this.getQuest().getGame().getPlayer());
159 }
160 else{
161 // Target the roof
162 ball.setTargetTypeTargetPosition(new Pos(Random.between(1, 99), Random.between(4, 9)));
163 }
164
165 // Add it to the quest
166 this.getQuest().addEntity(ball);
167 }
168
169 private dontMove(): void{
170 this.getQuestEntityMovement().setOffset(new Pos(0, 0));

Callers 1

updateMethod · 0.95

Calls 9

getQuestMethod · 0.80
plusMethod · 0.80
getGlobalPositionMethod · 0.80
getPlayerMethod · 0.80
addEntityMethod · 0.80
getGameMethod · 0.45

Tested by

no test coverage detected