From 4b690910bf3da6aada95a14704f5d1a6f9257ac5 Mon Sep 17 00:00:00 2001 From: Andrei Alexeyev <0x416b617269@gmail.com> Date: Wed, 18 Oct 2017 02:53:42 +0300 Subject: [PATCH] another stupid Elly spelly (unfinished) --- src/projectile.c | 4 + src/projectile.h | 1 + src/stages/stage6.c | 2 + src/stages/stage6.h | 1 + src/stages/stage6_events.c | 153 +++++++++++++++++++++++++++++++++++++ src/stages/stage6_events.h | 1 + 6 files changed, 162 insertions(+) diff --git a/src/projectile.c b/src/projectile.c index f4f35590..778900e4 100644 --- a/src/projectile.c +++ b/src/projectile.c @@ -288,6 +288,10 @@ void PartDraw(Projectile *proj, int t) { glColor3f(1,1,1); } +void ProjNoDraw(Projectile *proj, int t) { + +} + void Blast(Projectile *p, int t) { if(t == 1) { p->args[1] = frand()*360 + frand()*I; diff --git a/src/projectile.h b/src/projectile.h index 31da6bee..a4263871 100644 --- a/src/projectile.h +++ b/src/projectile.h @@ -85,6 +85,7 @@ void PartDraw(Projectile *p, int t); void ProjDrawNoFlareAdd(Projectile *p, int t); void ProjDrawAdd(Projectile *p, int t); void ProjDrawSub(Projectile *p, int t); +void ProjNoDraw(Projectile *proj, int t); void Blast(Projectile *p, int t); diff --git a/src/stages/stage6.c b/src/stages/stage6.c index 49747c55..d1f96bd7 100644 --- a/src/stages/stage6.c +++ b/src/stages/stage6.c @@ -31,6 +31,8 @@ struct stage6_spells_s stage6_spells = { .baryon = { .many_world_interpretation = {{ 8, 9, 10, 11}, AT_Spellcard, "Eigenstate ~ Many-World Interpretation", 40, 60000, elly_eigenstate, elly_spellbg_modern, BOSS_DEFAULT_GO_POS}, + .wave_particle_duality = {{28, 29, 30, 31}, AT_Spellcard, "de Broglie Sign ~ Wave-Particle Duality", 60, 50000, + elly_broglie, elly_spellbg_modern, BOSS_DEFAULT_GO_POS}, .spacetime_curvature = {{12, 13, 14, 15}, AT_Spellcard, "Ricci Sign ~ Spacetime Curvature", 50, 90000, elly_ricci, elly_spellbg_modern, BOSS_DEFAULT_GO_POS}, .higgs_boson_uncovered = {{16, 17, 18, 19}, AT_Spellcard, "LHC ~ Higgs Boson Uncovered", 50, 60000, diff --git a/src/stages/stage6.h b/src/stages/stage6.h index 9f5fba8c..aca7021a 100644 --- a/src/stages/stage6.h +++ b/src/stages/stage6.h @@ -27,6 +27,7 @@ extern struct stage6_spells_s { AttackInfo baryon_first; struct { AttackInfo many_world_interpretation; + AttackInfo wave_particle_duality; AttackInfo spacetime_curvature; AttackInfo higgs_boson_uncovered; } baryon; diff --git a/src/stages/stage6_events.c b/src/stages/stage6_events.c index a5470aeb..2b1abcd1 100644 --- a/src/stages/stage6_events.c +++ b/src/stages/stage6_events.c @@ -579,6 +579,10 @@ int baryon_center(Enemy *e, int t) { free_ref(cimag(e->args[1])); } + if(global.boss) { + e->pos = global.boss->pos; + } + return 1; } @@ -699,6 +703,155 @@ void elly_eigenstate(Boss *b, int t) { set_baryon_rule(baryon_reset); } +int broglie_particle(Projectile *p, int t) { + if(t == EVENT_DEATH) { + free_ref(p->args[0]); + return 1; + } + + if(t < 0) { + return 1; + } + + int scattertime = creal(p->args[1]); + + if(t < scattertime) { + Laser *laser = (Laser*)REF(p->args[0]); + + if(laser) { + // p->args[3] = laser->prule(laser, max(0, t - cimag(p->args[1]))) - p->pos; + complex oldpos = p->pos; + p->pos = laser->prule(laser, min(t, cimag(p->args[1]))); + + if(oldpos != p->pos) { + p->angle = carg(p->pos - oldpos); + } + } + } else { + if(t == scattertime) { + p->draw = ProjDrawAdd; + p->angle += nfrand() * M_PI/8; + p->args[2] = -cabs(p->args[2]) * cexp(I*p->angle); + } + + p->angle = carg(p->args[2]); + p->pos = p->pos + p->args[2]; + } + + return 1; +} + + +int broglie_charge(Projectile *p, int t) { + if(t < 0) { + return 1; + } + + int firetime = creal(p->args[1]); + + if(t == firetime) { + complex aim = p->args[0]; + double dt = 100; + float a = 5; + Laser *l = create_lasercurve4c(p->pos, dt, dt, p->clr, las_sine, 5*aim, a*M_PI/8, 0.2, 0); + l->width = 20; + + for(double ofs = 0; ofs < dt; ofs += 1) { + complex pos = l->prule(l, ofs); + + for(int i = 0; i < 2; ++i) { + create_projectile4c(i ? "rice" : "thickrice", pos, p->clr, broglie_particle, + add_ref(l), I*ofs + dt + ofs - 20, cexp(I*frand()*M_PI*2), 0)->draw = ProjNoDraw; + } + } + + return ACTION_DESTROY; + } + + return 1; +} + +int baryon_broglie(Enemy *e, int t) { + if(t < 0) { + return 1; + } + + int t_real = t; + + t %= 300; + TIMER(&t); + Enemy *master = NULL; + + for(Enemy *e = global.enemies; e; e = e->next) { + if(e->draw_rule == Baryon) { + master = e; + break; + } + } + + assert(master != NULL); + + if(master != e) { + if(t_real < 300) { + GO_TO(e, global.boss->pos, 0.03); + } else { + e->pos = global.boss->pos; + } + + return 1; + } + + int delay = 140; + int step = 30; + int cnt = 3; + int fire_delay = 120; + + FROM_TO(delay, delay + step * cnt - 1, step) { + double a = 2*M_PI * (0.25 + 1.0/cnt*_i); + complex n = cexp(I*a); + + create_projectile2c("ball", e->pos + 15*n, + hsl(((t_real / 300) * 2*M_PI/3 + a + M_PI/6) / (M_PI*2), 1.0, 0.55), + broglie_charge, n, fire_delay - step * _i)->draw = ProjDrawAdd; + } + + if(t < delay || t > delay + fire_delay) { + complex target_pos = global.boss->pos + 100 * cexp(I*carg(global.plr.pos - global.boss->pos)); + GO_TO(e, target_pos, 0.03); + } + + return 1; +} + +void elly_broglie(Boss *b, int t) { + TIMER(&t); + + if(t < 0) { + return; + } + + AT(0) { + set_baryon_rule(baryon_broglie); + } + + AT(EVENT_DEATH) { + set_baryon_rule(baryon_reset); + } + + double ofs = 100; + + complex positions[] = { + VIEWPORT_W-ofs + ofs*I, + ofs + (VIEWPORT_H-ofs)*I, + VIEWPORT_W-ofs + (VIEWPORT_H-ofs)*I, + ofs + ofs*I, + }; + + if(t/300 > 0) { + GO_TO(b, positions[(t/600) % (sizeof(positions)/sizeof(complex))], 0.02); + } +} + int baryon_nattack(Enemy *e, int t) { if(t < 0) return 1; diff --git a/src/stages/stage6_events.h b/src/stages/stage6_events.h index 7a0dfa56..894596bf 100644 --- a/src/stages/stage6_events.h +++ b/src/stages/stage6_events.h @@ -16,6 +16,7 @@ void elly_kepler(Boss*, int); void elly_newton(Boss*, int); void elly_maxwell(Boss*, int); void elly_eigenstate(Boss*, int); +void elly_broglie(Boss*, int); void elly_ricci(Boss*, int); void elly_lhc(Boss*, int); void elly_theory(Boss*, int);