(finalPosition: Pos, damage: number, timeToLive: number, colorType: ColorType)
| 90 | |
| 91 | // Public methods |
| 92 | public addMagicBall(finalPosition: Pos, damage: number, timeToLive: number, colorType: ColorType): void{ |
| 93 | // Set the first position (either the mouth or one of the eyes) |
| 94 | var firstPosition: Pos; |
| 95 | switch(Random.upTo(2)){ |
| 96 | case 0: firstPosition = new Pos(15, 15); break; |
| 97 | case 1: firstPosition = new Pos(25, 15); break; |
| 98 | case 2: firstPosition = new Pos(20, 26); break; |
| 99 | } |
| 100 | |
| 101 | // Create the fireball |
| 102 | var magicBall: DeveloperMagicBall = new DeveloperMagicBall(this.getQuest(), |
| 103 | this.getGlobalPosition().plus(firstPosition), |
| 104 | new Naming("A magic ball", "a magic ball"), |
| 105 | new Color(colorType), |
| 106 | new Pos(2, 1), |
| 107 | damage, |
| 108 | this.getAndPossiblyCreateSpellCastingDamageReason(new Naming("A magic ball", "a magic ball")), |
| 109 | timeToLive |
| 110 | ); |
| 111 | |
| 112 | // No target |
| 113 | magicBall.setTargetTypeTargetPosition(finalPosition, new Pos(1, 1)); |
| 114 | |
| 115 | // Add the entity |
| 116 | this.getQuest().addEntity(magicBall); |
| 117 | } |
| 118 | |
| 119 | public createTexts(): void{ |
| 120 | // Empty the array |
no test coverage detected