Created
November 9, 2024 15:44
-
-
Save nulleqcodes/ac2ed7e0b5d4ee2d23a716abfdbecf1b to your computer and use it in GitHub Desktop.
Lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---mobdefinition_Destructor--- | |
Prefab :: colossus | |
Range Behavior :: [[Stationary]] | |
Abilities :: [[Colossus Spin]] | |
Bounding Box :: 0 2.73 2.5 3.0 | |
Type :: Boss | |
Loot :: [[Colossus]] | |
---ability_Colossus Spin--- | |
Bullet Definition :: [[colossusspin]] | |
Max Range :: 100.0 | |
---bulletdef_colossusspin--- | |
fire 1 relative 0 | |
wait 1000 | |
---script_colossus_Monster--- | |
resetVars := func() { | |
scriptVars["timeSinceSpin"] = 0.0 | |
scriptVars["rnd"] = import("rand") | |
} | |
shoot := func(loc0, loc1, dir0, dir1, spd) { | |
useAbilityAtPosition(myEntityId, "Colossus Spin", [loc0,loc1,0.0], [loc0+dir0,loc1+dir1,0.0], spd) | |
} | |
if !isDead { | |
if is_undefined(scriptVars["timeSinceSpin"]) { | |
resetVars() | |
} | |
if targetEntityId > 0 { | |
scriptVars["timeSinceSpin"] += delta | |
if castingAction == 0 { | |
z := scriptVars["rnd"] | |
math := import("math") | |
m := entityPosition(myEntityId) | |
c := [[0,0],[1,0],[1,1],[0,1]] | |
p := [0,0,0,0] | |
for i:=0;i<4;i++ { | |
for j:=0;j<2;j++ { | |
c[i][j] = 2.2+27.6*c[i][j] | |
} | |
p[i] = positionInCurrentRoom(myEntityId, [c[i][0],c[i][1],0.0]) | |
} | |
for scriptVars["timeSinceSpin"] > 0 { | |
scriptVars["timeSinceSpin"] -= 0.9 | |
prevside := z.intn(4) | |
side := (prevside+1)%4 | |
nextside := (side+1)%4 | |
ang := z.float()*math.pi/2 | |
a := math.sin(ang) | |
ac := math.sqrt(math.max(1-a*a,0.0)) | |
ad0 := (p[prevside][0]-p[side][0])*a | |
ad1 := (p[prevside][1]-p[side][1])*a | |
adc0 := (p[nextside][0]-p[side][0])*ac | |
adc1 := (p[nextside][1]-p[side][1])*ac | |
loc0 := p[side][0] | |
loc1 := p[side][1] | |
dir0 := adc0+ad0 | |
dir1 := adc1+ad1 | |
w0 := dir1 | |
w1 := -dir0 | |
lim := 0 | |
if a > ac { | |
w0 *= -1 | |
w1 *= -1 | |
lim = ac/a | |
} else { | |
lim = a/ac | |
} | |
bsp := 2.2 | |
i := 0.0 | |
stp := 0.0125 | |
dvr := bsp*math.sqrt(2) | |
for i < 200 && i*lim <= 1.0 { | |
spd := bsp*math.sqrt(1+i*i) | |
shoot(loc0, loc1, dir0+w0*i, dir1+w1*i, spd) | |
if i > 0.001 && i <= lim { | |
shoot(loc0, loc1, dir0-w0*i, dir1-w1*i, spd) | |
} | |
if i < 1 { | |
i += stp*spd/dvr | |
} else if i < 4 { | |
i += stp*i | |
} else { | |
i += stp*i*i/4 | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment