()
| 80 | |
| 81 | // Private methods |
| 82 | private castFireball(): void{ |
| 83 | // Create the fireball |
| 84 | var fireBall: Fireball = new Fireball(this.getQuest(), |
| 85 | this.getGlobalPosition().plus(new Pos(3, 4)), |
| 86 | new Naming("The devil's fireball", "the devil's fireball"), |
| 87 | new Color(ColorType.DEVIL_FIREBALL), |
| 88 | new Pos(2, 1), |
| 89 | 800, |
| 90 | this.getAndPossiblyCreateSpellCastingDamageReason(new Naming("The devil's fireball", "the devil's fireball")) |
| 91 | ); |
| 92 | |
| 93 | // If the player is on our left |
| 94 | if(this.getQuest().getGame().getPlayer().getGlobalPosition().x < this.getGlobalPosition().x){ |
| 95 | // No target |
| 96 | fireBall.setTargetTypeNoTarget(new Pos(-Random.between(3, 7), 0)); |
| 97 | } |
| 98 | // Else |
| 99 | else{ |
| 100 | // We target the player |
| 101 | fireBall.setTargetTypeTargetEntity(this.getQuest().getGame().getPlayer(), null, new Pos(1, 1)); |
| 102 | } |
| 103 | |
| 104 | // Add the entity |
| 105 | this.getQuest().addEntity(fireBall); |
| 106 | } |
| 107 | |
| 108 | private handleFireballs(): void{ |
| 109 | if(Random.oneChanceOutOf(2)) this.castFireball(); |
no test coverage detected