2011-04-10 10:23:24 +02:00
|
|
|
/*
|
|
|
|
* This software is licensed under the terms of the MIT-License
|
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
|
|
|
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "plrmodes.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "global.h"
|
|
|
|
|
2011-06-25 12:41:40 +02:00
|
|
|
/* Youmu */
|
|
|
|
|
|
|
|
void youmu_shot(Player *plr) {
|
|
|
|
if(plr->fire) {
|
|
|
|
if(!(global.frames % 4)) {
|
|
|
|
create_projectile("youmu", plr->pos + 10 - I*20, NULL, linear, rarg(-20I))->type = PlrProj;
|
|
|
|
create_projectile("youmu", plr->pos - 10 - I*20, NULL, linear, rarg(-20I))->type = PlrProj;
|
|
|
|
|
|
|
|
if(plr->power >= 2) {
|
|
|
|
float a = 0.20;
|
|
|
|
if(plr->focus > 0) a = 0.06;
|
|
|
|
create_projectile("youmu", plr->pos - 10 - I*20, NULL, linear, rarg(I*-20*cexp(-I*a)))->type = PlrProj;
|
|
|
|
create_projectile("youmu", plr->pos + 10 - I*20, NULL, linear, rarg(I*-20*cexp(I*a)))->type = PlrProj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float a = 1;
|
|
|
|
if(plr->focus > 0)
|
|
|
|
a = 0.4;
|
|
|
|
if(plr->shot == YoumuHoming && !(global.frames % 7)) {
|
|
|
|
complex ref = -1;
|
|
|
|
if(global.boss != NULL)
|
|
|
|
ref = add_ref(global.boss);
|
|
|
|
else if(global.enemies != NULL)
|
|
|
|
ref = add_ref(global.enemies);
|
|
|
|
|
|
|
|
if(ref != -1)
|
|
|
|
create_projectile("hghost", plr->pos, NULL, youmu_homing, rarg(a*cexp(I*rand()), ref))->type = PlrProj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(plr->shot == YoumuOpposite && plr->slaves == NULL)
|
|
|
|
create_enemy(&plr->slaves, youmu_opposite_draw, youmu_opposite_logic, plr->pos, ENEMY_IMMUNE, plr, 0);
|
|
|
|
}
|
|
|
|
|
2011-04-26 12:04:45 +02:00
|
|
|
void youmu_opposite_draw(Enemy *e, int t) {
|
|
|
|
complex pos = e->pos + ((Player *)e->parent)->pos;
|
2011-05-14 17:26:43 +02:00
|
|
|
|
2011-05-21 15:02:19 +02:00
|
|
|
create_particle("flare", pos, NULL, Shrink, timeout, rarg(10, -e->pos+10I));
|
2011-04-10 10:23:24 +02:00
|
|
|
}
|
|
|
|
|
2011-04-26 12:04:45 +02:00
|
|
|
void youmu_opposite_logic(Enemy *e, int t) {
|
|
|
|
if(t < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Player *plr = (Player *)e->parent;
|
2011-04-10 10:23:24 +02:00
|
|
|
|
|
|
|
if(plr->focus < 15) {
|
2011-05-14 17:26:43 +02:00
|
|
|
e->args[2] = carg(plr->pos - e->pos0);
|
2011-04-26 12:04:45 +02:00
|
|
|
e->pos = e->pos0 - plr->pos;
|
2011-04-10 10:23:24 +02:00
|
|
|
|
2011-04-26 12:04:45 +02:00
|
|
|
if(cabs(e->pos) > 30)
|
|
|
|
e->pos -= 5*cexp(I*carg(e->pos));
|
2011-04-10 10:23:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(plr->fire && !(global.frames % 4))
|
2011-05-21 15:02:19 +02:00
|
|
|
create_projectile("youmu", e->pos + plr->pos, NULL, linear, rarg(-20*cexp(I*e->args[2])))->type = PlrProj;
|
2011-04-10 10:23:24 +02:00
|
|
|
|
2011-04-26 12:04:45 +02:00
|
|
|
e->pos0 = e->pos + plr->pos;
|
2011-04-29 10:26:37 +02:00
|
|
|
}
|
|
|
|
|
2011-05-13 19:03:02 +02:00
|
|
|
int youmu_homing(Projectile *p, int t) { // a[0]: velocity, a[1]: target, a[2]: old velocity
|
2011-05-21 15:02:19 +02:00
|
|
|
p->angle = rand();
|
2011-05-13 19:03:02 +02:00
|
|
|
if(t == EVENT_DEATH) {
|
|
|
|
free_ref(p->args[1]);
|
|
|
|
}
|
2011-04-29 10:26:37 +02:00
|
|
|
|
2011-05-13 19:03:02 +02:00
|
|
|
complex tv = p->args[2];
|
|
|
|
if(REF(p->args[1]) != NULL)
|
|
|
|
tv = cexp(I*carg(((Enemy *)REF(p->args[1]))->pos - p->pos));
|
2011-04-29 10:26:37 +02:00
|
|
|
|
2011-05-13 19:03:02 +02:00
|
|
|
|
|
|
|
p->args[2] = tv;
|
2011-04-29 10:26:37 +02:00
|
|
|
|
2011-05-13 19:03:02 +02:00
|
|
|
p->pos += p->args[0]*log(t + 1) + tv*t*t/300.0;
|
2011-05-06 17:09:43 +02:00
|
|
|
p->pos0 = p->pos;
|
2011-04-29 10:26:37 +02:00
|
|
|
|
2011-05-13 19:03:02 +02:00
|
|
|
return 1;
|
2011-06-25 12:41:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Marisa */
|
|
|
|
|
|
|
|
int mari_laser(Projectile *p, int t) {
|
|
|
|
linear(p, t);
|
|
|
|
|
|
|
|
Player *plr = (Player *)REF(p->args[1]);
|
|
|
|
|
|
|
|
p->pos = plr->pos + p->pos - creal(p->pos0)*abs(plr->focus)/30.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void marisa_shot(Player *plr) {
|
|
|
|
if(plr->fire) {
|
|
|
|
if(!(global.frames % 4)) {
|
|
|
|
create_projectile("marisa", +10, NULL, mari_laser, rarg(-20I, (complex) add_ref(plr)))->type = PlrProj;
|
|
|
|
create_projectile("marisa", -10, NULL, mari_laser, rarg(-20I, (complex) add_ref(plr)))->type = PlrProj;
|
|
|
|
}
|
|
|
|
}
|
2011-04-10 10:23:24 +02:00
|
|
|
}
|