first elly non wip

This commit is contained in:
laochailan 2021-08-02 08:51:36 +02:00 committed by Andrei Alexeyev
parent a2a5fb6ada
commit 20a4f3b4c7
No known key found for this signature in database
GPG key ID: 72D26128040B9690
9 changed files with 108 additions and 96 deletions

View file

@ -62,13 +62,15 @@ TASK(scythe_update, { BoxedEllyScythe scythe; }) {
static void stage6_init_elly_scythe(EllyScythe *scythe, cmplx pos) {
scythe->pos = pos;
scythe->scale = 1;
scythe->scale = 0.7;
INVOKE_TASK(scythe_visuals, ENT_BOX(scythe));
INVOKE_TASK(scythe_update, ENT_BOX(scythe));
}
Boss *stage6_elly_init_scythe_attack(ScytheAttackTaskArgs *args) {
if(ENT_UNBOX(args->scythe) == NULL) {
// args->scythe = ENT_BOX();
Boss *b = NOT_NULL(ENT_UNBOX(args->base.boss));
args->scythe = ENT_BOX(stage6_host_elly_scythe(b->pos));
}
return INIT_BOSS_ATTACK(&args->base);
@ -90,6 +92,41 @@ DEFINE_EXTERN_TASK(stage6_elly_scythe_spin) {
}
}
DEFINE_EXTERN_TASK(stage6_elly_scythe_nonspell) {
EllyScythe *scythe = TASK_BIND(ARGS.scythe);
cmplx center = VIEWPORT_W/2.0 + 200.0 * I;
scythe->move = move_towards(center, 0.1);
WAIT(40);
scythe->move.retention = 0.9;
for(int t = 0;; t++) {
play_sfx_loop("shot1_loop");
real theta = 0.01 * t * (1 + 0.001 * t) + M_PI/2;
scythe->pos = center + 200 * cos(theta) * (1 + sin(theta) * I) / (1 + pow(sin(theta), 2));
scythe->angle = 0.2 * t * (1 + 0*0.001 * t);
cmplx dir = cdir(scythe->angle);
real vel = difficulty_value(1.4, 1.8, 2.2, 2.6);
cmplx color_dir = cdir(3 * theta);
if(t > 50) {
PROJECTILE(
.proto = pp_ball,
.pos = scythe->pos + 60 * dir * cdir(1.2),
.color = RGB(creal(color_dir), cimag(color_dir), creal(color_dir * cdir(2.1))),
.move = move_accelerated(0, 0.01 *vel * dir),
);
}
YIELD;
}
}
// REMOVE
void scythe_draw(Enemy *, int, bool) {
}
@ -119,38 +156,7 @@ int wait_proj(Projectile *p, int t) {
}
int scythe_infinity(Enemy *e, int t) {
if(t < 0) {
scythe_common(e, t);
return 1;
}
TIMER(&t);
FROM_TO(0, 40, 1) {
GO_TO(e, VIEWPORT_W/2+200.0*I, 0.01);
e->args[2] = fmin(0.8, creal(e->args[2])+0.0003*t*t);
e->args[1] = creal(e->args[1]) + I*fmin(0.2, cimag(e->args[1])+0.0001*t*t);
}
FROM_TO_SND("shot1_loop",40, 3000, 1) {
float w = fmin(0.15, 0.0001*(t-40));
e->pos = VIEWPORT_W/2 + 200.0*I + 200*cos(w*(t-40)+M_PI/2.0) + I*80*sin(creal(e->args[0])*w*(t-40));
PROJECTILE(
.proto = pp_ball,
.pos = e->pos+80*cexp(I*creal(e->args[1])),
.color = RGB(cos(creal(e->args[1])), sin(creal(e->args[1])), cos(creal(e->args[1])+2.1)),
.rule = asymptotic,
.args = {
(1+0.4*global.diff)*cexp(I*creal(e->args[1])),
3 + 0.2 * global.diff
}
);
}
scythe_common(e, t);
return 1;
}
int scythe_reset(Enemy *e, int t) {
if(t < 0) {

View file

@ -34,9 +34,17 @@ DEFINE_ENTITY_TYPE(EllyScythe, {
EllyScythe *stage6_host_elly_scythe(cmplx pos);
DEFINE_TASK_INTERFACE_WITH_BASE(ScytheAttack, BossAttack, {
BoxedEllyScythe scythe;
});
typedef TASK_IFACE_ARGS_TYPE(ScytheAttack) ScytheAttackTaskArgs;
Boss *stage6_elly_init_scythe_attack(ScytheAttackTaskArgs *args);
// duration < 0 means infinite duration
DECLARE_EXTERN_TASK(stage6_elly_scythe_spin, { BoxedEllyScythe scythe; real angular_velocity; int duration; });
DECLARE_EXTERN_TASK(stage6_elly_scythe_nonspell, { BoxedEllyScythe scythe; });
void scythe_draw(Enemy *, int, bool);
void scythe_common(Enemy*, int);

View file

@ -9,25 +9,13 @@
#include "taisei.h"
#include "nonspells.h"
#include "../elly.h"
MODERNIZE_THIS_FILE_AND_REMOVE_ME
DEFINE_EXTERN_TASK(stage6_boss_nonspell_1) {
Boss *boss = stage6_elly_init_scythe_attack(&ARGS);
BEGIN_BOSS_ATTACK(&ARGS.base);
void elly_frequency(Boss *b, int t) {
TIMER(&t);
Enemy *scythe;
INVOKE_SUBTASK(stage6_elly_scythe_nonspell, ARGS.scythe);
AT(EVENT_BIRTH) {
scythe = find_scythe();
aniplayer_queue(&b->ani, "snipsnip", 0);
scythe->birthtime = global.frames;
scythe->logic_rule = scythe_infinity;
scythe->args[0] = 2;
}
AT(EVENT_DEATH) {
scythe = find_scythe();
scythe->birthtime = global.frames;
scythe->logic_rule = scythe_reset;
scythe->args[0] = 0;
}
STALL;
}

View file

@ -14,7 +14,7 @@ MODERNIZE_THIS_FILE_AND_REMOVE_ME
void elly_frequency2(Boss *b, int t) {
TIMER(&t);
/*
AT(0) {
Enemy *scythe = find_scythe();
aniplayer_queue(&b->ani, "snipsnip", 0);
@ -39,5 +39,5 @@ void elly_frequency2(Boss *b, int t) {
.rule = asymptotic,
.args = { 2*n/cabs(n), 3 }
);
}
}*/
}

View file

@ -15,6 +15,8 @@
#include "stages/stage6/elly.h"
DECLARE_EXTERN_TASK_WITH_INTERFACE(stage6_boss_nonspell_1, ScytheAttack);
void elly_frequency(Boss*, int);
void elly_frequency2(Boss*, int);
void elly_paradigm_shift(Boss*, int);

View file

@ -14,6 +14,7 @@
MODERNIZE_THIS_FILE_AND_REMOVE_ME
static int scythe_newton(Enemy *e, int t) {
if(t < 0) {
scythe_common(e, t);
@ -72,21 +73,35 @@ static int newton_apple(Projectile *p, int t) {
return r;
}
void elly_newton(Boss *b, int t) {
TIMER(&t);
TASK(newton_spawn_square, { cmplx pos; cmplx dir; real width; int count; real speed; }) {
AT(0) {
Enemy *scythe = find_scythe();
scythe->birthtime = global.frames;
scythe->logic_rule = scythe_newton;
elly_clap(b,100);
}
int delay = round(ARGS.width / (ARGS.count-1) / ARGS.speed);
for(int i = 0; i < ARGS.count; i++) {
for(int j = 0; j < ARGS.count; j++) {
real x = ARGS.width * (-0.5 + j / (real) (ARGS.count-1));
AT(EVENT_DEATH) {
Enemy *scythe = find_scythe();
scythe->birthtime = global.frames;
scythe->logic_rule = scythe_reset;
PROJECTILE(
.proto = pp_ball,
.pos = ARGS.pos + x * ARGS.dir * I,
.color = RGB(0, 0.5, 1),
.move = move_accelerated(ARGS.speed * ARGS.dir, 0*0.01*I),
.max_viewport_dist = VIEWPORT_H,
);
}
WAIT(delay);
}
}
DEFINE_EXTERN_TASK(stage6_spell_newton) {
Boss *boss = stage6_elly_init_scythe_attack(&ARGS);
BEGIN_BOSS_ATTACK(&ARGS.base);
//INVOKE_SUBTASK(scythe_newton, ARGS.scythe);
/*int start_delay = difficulty_value(210, 150, 90, 30);
WAIT(start_delay);
FROM_TO(30 + 60 * (D_Lunatic - global.diff), 10000000, 30 - 6 * global.diff) {
Sprite *apple = get_sprite("proj/apple");
@ -112,26 +127,25 @@ void elly_newton(Boss *b, int t) {
);
play_sfx("shot3");
}
}*/
FROM_TO(0, 100000, 20+10*(global.diff>D_Normal)) {
float a = 2.7*_i+carg(global.plr.pos-b->pos);
int x, y;
float w = global.diff/2.0+1.5;
int rows = 5;
real width = VIEWPORT_H / (real)rows;
play_sfx("shot_special1");
for(x = -w; x <= w; x++) {
for(y = -w; y <= w; y++) {
PROJECTILE(
.proto = pp_ball,
.pos = b->pos+(x+I*y)*25*cexp(I*a),
.color = RGB(0, 0.5, 1),
.rule = linear,
.args = { (2+(_i==0))*cexp(I*a) }
);
}
for(int i = 0;; i++) {
real y = width * (0.5 + i);
for(int s = -1; s <= 1; s += 2) {
cmplx dir = cdir(i) * I;
cmplx pos = boss->pos + 0* dir;
INVOKE_SUBTASK(newton_spawn_square, pos, -s*dir,
.width = width,
.count = 6,
.speed = 3
);
}
WAIT(20);
}
}

View file

@ -16,11 +16,7 @@
#define ELLY_TOE_TARGET_POS (VIEWPORT_W/2+VIEWPORT_H/2*I)
DEFINE_TASK_INTERFACE_WITH_BASE(ScytheAttack, BossAttack, {
BoxedEllyScythe scythe;
});
typedef TASK_IFACE_ARGS_TYPE(ScytheAttack) ScytheAttackTaskArgs;
Boss *stage6_elly_init_scythe_attack(ScytheAttackTaskArgs *args);
DECLARE_EXTERN_TASK_WITH_INTERFACE(stage6_spell_newton, ScytheAttack);
void elly_spellbg_toe(Boss*, int);

View file

@ -30,7 +30,7 @@ struct stage6_spells_s stage6_spells = {
.scythe = {
.occams_razor = {
{ 0, 1, 2, 3}, AT_Spellcard, "Newton Sign “Occams Razor”", 50, 60000,
elly_newton, elly_spellbg_classic, BOSS_DEFAULT_GO_POS, 6
NULL, elly_spellbg_classic, BOSS_DEFAULT_GO_POS, 6, TASK_INDIRECT_INIT(BossAttack, stage6_spell_newton),
},
.orbital_clockwork = {
{24, 25, 26, 27}, AT_Spellcard, "Kepler Sign “Orbital Clockwork”", 50, 60000,

View file

@ -190,12 +190,8 @@ TASK_WITH_INTERFACE(elly_intro, ScytheAttack) {
BEGIN_BOSS_ATTACK(&ARGS.base);
boss->move = move_towards_power(BOSS_DEFAULT_GO_POS, 0.3, 0.5);
log_warn("hello");
assert(ARGS.scythe.ent != NULL);
EllyScythe *scythe = NOT_NULL(ENT_UNBOX(ARGS.scythe));
WAIT(200);
scythe->move = move_towards_power(BOSS_DEFAULT_GO_POS, 0.3, 0.5);
STALL;
@ -254,10 +250,10 @@ TASK(spawn_boss, NO_ARGS) {
INVOKE_TASK_WHEN(&e->music_changes, common_start_bgm, "stage6boss_phase1");
WAIT_EVENT(&global.dialog->events.fadeout_began);
boss_add_attack_task_with_args(boss, AT_Move, "Catch the Scythe", 60, 30000, TASK_INDIRECT(ScytheAttack, elly_intro).base, NULL, scythe_args.base);
//boss_add_attack(boss, AT_Move, "Catch the Scythe", 6, 0, elly_intro, NULL);
/*boss_add_attack(b, AT_Normal, "Frequency", 40, 50000, elly_frequency, NULL);
boss_add_attack_from_info(b, &stage6_spells.scythe.occams_razor, false);
boss_add_attack_task_with_args(boss, AT_Move, "Catch the Scythe", 5, 30000, TASK_INDIRECT(ScytheAttack, elly_intro).base, NULL, scythe_args.base);
boss_add_attack_task_with_args(boss, AT_Normal, "Frequency", 40, 50000, TASK_INDIRECT(ScytheAttack, stage6_boss_nonspell_1).base, NULL, scythe_args.base);
boss_add_attack_from_info_with_args(boss, &stage6_spells.scythe.occams_razor, scythe_args.base);
/*
boss_add_attack(b, AT_Normal, "Frequency2", 40, 50000, elly_frequency2, NULL);
boss_add_attack_from_info(b, &stage6_spells.scythe.orbital_clockwork, false);
boss_add_attack_from_info(b, &stage6_spells.scythe.wave_theory, false);
@ -275,6 +271,8 @@ TASK(spawn_boss, NO_ARGS) {
boss_add_attack(b, AT_Move, "ToE transition", 7, 0, elly_begin_toe, NULL);
boss_add_attack_from_info(b, &stage6_spells.final.theory_of_everything, false);*/
boss_engage(boss);
WAIT_EVENT(&global.boss->events.defeated);
AWAIT_SUBTASKS;
}