Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mob
- proc
- windeffect()
- set background = 1
- spawn()
- while(src.windeffect)
- new /Explosion(new /Effect/MysticWind(src.loc,1,9))
- sleep(rand(10,15))
- Effect
- var
- atom/orig // The point of origin for the explosion
- speed = 1 // The rate at which the explosion expands in ticks
- basepower = 2 // The strength of the explosion at ground zero
- proc
- Apply(loc,power,dir) // The function to override in children classes to change behaviour of explosion.
- return power - 1
- New(atom/p_orig, p_speed, p_basepower)
- orig = p_orig
- speed = p_speed
- basepower = p_basepower
- //------------------------
- //Mystic Wind Effect
- //------------------------
- MysticWind
- Apply(loc,power,dir)
- var/i
- var/turf/T
- T = loc
- if(T)
- var/mob/M = locate() in T
- if(M)
- if(M.MaxHP<= usr.MaxHP)
- step(M,dir)
- //Show the wind
- i = image('Shockwave.dmi',loc, dir = get_dir(orig,loc))
- world << i
- spawn(1)
- del(i)
- //Use the base expansion algorithm
- return ..()
- Explosion
- var
- Explosion/Queue/Q
- New(Effect/theeffect)
- var/loc
- var/pow
- var/dir
- var/dist
- var/lastdist = 0
- var/D
- Q = new()
- var/dirlist[] = list(NORTH,SOUTH,EAST,WEST,NORTHWEST,NORTHEAST,SOUTHWEST,SOUTHEAST)
- var/newpow = theeffect.Apply(theeffect.orig,theeffect.basepower,0)
- //Initialize the starting queue
- for(D in dirlist)
- Q.L.Add(D)
- Q.L.Add(get_step(theeffect.orig,D))
- Q.L.Add(newpow)
- Q.L.Add(1)
- while(Q.L.len)
- dir = Q.Pop()
- loc = Q.Pop()
- pow = Q.Pop()
- dist = Q.Pop()
- if(lastdist != dist)
- if(theeffect.speed >= 0)
- sleep(theeffect.speed)
- lastdist = dist
- if(pow > 0 && loc)
- //If there is only one bit set(ie: Cardinal direction)
- //this will return 0
- newpow = theeffect.Apply(loc,pow,dir)
- if(dir & (dir-1))
- if(dir & NORTH)
- Q.L.Add(NORTH)
- Q.L.Add(get_step(loc,NORTH))
- Q.L.Add(newpow)
- Q.L.Add(dist+1)
- if(dir & SOUTH)
- Q.L.Add(SOUTH)
- Q.L.Add(get_step(loc,SOUTH))
- Q.L.Add(newpow)
- Q.L.Add(dist+1)
- if(dir & EAST)
- Q.L.Add(EAST)
- Q.L.Add(get_step(loc,EAST))
- Q.L.Add(newpow)
- Q.L.Add(dist+1)
- if(dir & WEST)
- Q.L.Add(WEST)
- Q.L.Add(get_step(loc,WEST))
- Q.L.Add(newpow)
- Q.L.Add(dist+1)
- Q.L.Add(dir)
- Q.L.Add(get_step(loc,dir))
- Q.L.Add(newpow)
- Q.L.Add(dist+1)
- Queue
- var/L[]
- New()
- L = new()
- Del()
- del(L)
- proc
- Pop()
- . = L[1]
- L.Cut(1,2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement