11import * as fx from "./fx" ;
22import * as sprites from "./sprites.json" ;
3- import { Damage } from "./actions" ;
43import { Bleeding , Damaging , DespawnTimer , Frozen , HitStreak , LightningStrike , Seeking } from "./behaviours" ;
54import { tween } from "./engine" ;
65import { Behaviour , GameObject , RARE , Ritual } from "./game" ;
7- import { DEG_180 , DEG_360 , distance , randomFloat , randomInt } from "./helpers" ;
6+ import { DEG_180 , randomFloat , randomInt } from "./helpers" ;
87import { SkeletonLord , Spell } from "./objects" ;
9- import { screenshake } from "./renderer" ;
10- import { CORPSE , LIVING , UNDEAD } from "./tags" ;
8+ import { CORPSE , LIVING } from "./tags" ;
119import { shop } from "./shop" ;
1210
1311// Ritual tags
@@ -53,7 +51,7 @@ export let Hunter: Ritual = {
5351 tags : HOMING ,
5452 rarity : RARE ,
5553 name : "Hunter" ,
56- description : "Spells seek living enemies " ,
54+ description : "Spells seek targets " ,
5755 onCast ( projectile ) {
5856 projectile . addBehaviour ( new Seeking ( projectile ) ) ;
5957 } ,
@@ -94,7 +92,7 @@ class KnockbackSpell extends Behaviour {
9492export let Knockback : Ritual = {
9593 tags : NONE ,
9694 name : "Knockback" ,
97- description : "Spells knock enemies backwards" ,
95+ description : "Spells knock backwards" ,
9896 onCast ( spell ) {
9997 spell . addBehaviour ( new KnockbackSpell ( spell ) ) ;
10098 } ,
@@ -148,7 +146,7 @@ export let Rain: Ritual = {
148146export let Drunkard : Ritual = {
149147 tags : NONE ,
150148 name : "Drunkard" ,
151- description : "Do 2x damage, but your aim is wobbly " ,
149+ description : "2x damage, wobbly aim" ,
152150 onCast ( spell ) {
153151 spell . vx += randomInt ( 100 ) - 50 ;
154152 spell . vy += randomInt ( 100 ) - 50 ;
@@ -165,25 +163,24 @@ export let Seer: Ritual = {
165163 }
166164} ;
167165
168- export let Unchained : Ritual = {
166+ export let Tearstone : Ritual = {
169167 tags : NONE ,
170168 rarity : RARE ,
171- name : "Unchained" ,
172- description : "3x damage but max hp is 1" ,
173- onActive ( ) {
174- game . player . hp = game . player . maxHp = 1 ;
175- } ,
169+ name : "Tearstone" ,
170+ description : "3x damage when on 1 HP" ,
176171 onCast ( spell ) {
177- spell . getBehaviour ( Damaging ) ! . amount *= 3 ;
172+ if ( game . player . hp === 1 ) {
173+ spell . getBehaviour ( Damaging ) ! . amount *= 3 ;
174+ }
178175 }
179176} ;
180177
181178export let Impatience : Ritual = {
182- tags : CASTING_RATE ,
179+ tags : NONE ,
183180 name : "Impatience" ,
184- description : "Casts recharge 2x faster" ,
181+ description : "Resurrection recharges 2x faster" ,
185182 onActive ( ) {
186- game . spell . castRechargeRate /= 2 ;
183+ game . ability . cooldown /= 2 ;
187184 }
188185} ;
189186
@@ -210,12 +207,17 @@ export let Bleed: Ritual = {
210207 }
211208} ;
212209
213- export let BigFred : Ritual = {
210+ export let Allegiance : Ritual = {
214211 tags : NONE ,
215- name : "Big Fred" ,
216- description : "Summon Norman's Neighbour each resurrection" ,
212+ rarity : RARE ,
213+ name : "Allegiance" ,
214+ description : "Summon your honour guard after resurrections" ,
217215 onResurrect ( ) {
218- game . spawn ( SkeletonLord ( ) , game . player . x , game . player . y ) ;
216+ for ( let i = 0 ; i < 3 ; i ++ ) {
217+ let unit = SkeletonLord ( ) ;
218+ unit . updateSpeed = 200 ;
219+ game . spawn ( unit , i * - 15 , 0 ) ;
220+ }
219221 } ,
220222} ;
221223
@@ -272,11 +274,45 @@ export let Chilly: Ritual = {
272274 if ( randomFloat ( ) <= 0.1 ) {
273275 spell . emitter ! . variants = [ [ sprites . p_ice_1 , sprites . p_ice_2 , sprites . p_ice_3 ] ] ;
274276 spell . sprite = sprites . p_skull ;
275- spell . removeBehaviour ( spell . getBehaviour ( Damaging ) ! ) ;
277+ spell . getBehaviour ( Damaging ) ! . amount = 0 ;
276278 // Frozen has to be added before other behaviours, so that it can prevent
277279 // them from updating
278- spell . addBehaviour ( ) . onCollision = target =>
279- target . addBehaviour ( new Frozen ( target ) , 0 ) ;
280+ spell . addBehaviour ( ) . onCollision = target => {
281+ // King can't be frozen
282+ if ( target . mass < 1000 ) {
283+ target . addBehaviour ( new Frozen ( target ) , 0 ) ;
284+ }
285+ } ;
280286 }
281287 } ,
282288} ;
289+
290+ export let Vengeful : Ritual = {
291+ tags : NONE ,
292+ name : "Vengeful" ,
293+ description : "20% chance to resurrect larger skeletons" ,
294+ onResurrection ( object ) {
295+ if ( randomFloat ( ) < 0.2 ) {
296+ game . despawn ( object ) ;
297+ game . spawn ( SkeletonLord ( ) , object . x , object . y ) ;
298+ }
299+ } ,
300+ } ;
301+
302+ export let Avarice : Ritual = {
303+ tags : NONE ,
304+ name : "Avarice" ,
305+ description : "+1 soul for each corpse you resurrect" ,
306+ onResurrection ( ) {
307+ game . addSouls ( 1 ) ;
308+ } ,
309+ } ;
310+
311+ export let Hardened : Ritual = {
312+ tags : NONE ,
313+ name : "Hardened" ,
314+ description : "Unead have +1 HP*" ,
315+ onResurrection ( object ) {
316+ object . hp = object . maxHp += 1 ;
317+ }
318+ } ;
0 commit comments