Merge pull request #47 from BjossiAlfreds/float

Restored floater rogue features
This commit is contained in:
Yamagi 2019-09-28 17:01:52 +02:00 committed by GitHub
commit 65ea25f58e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 3 deletions

View file

@ -54,7 +54,7 @@ floater_fire_blaster(edict_t *self)
vec3_t dir; vec3_t dir;
int effect; int effect;
if (!self) if (!self || !self->enemy || !self->enemy->inuse)
{ {
return; return;
} }
@ -285,6 +285,31 @@ mmove_t floater_move_attack1 = {
floater_run floater_run
}; };
/* circle strafe frames */
mframe_t floater_frames_attack1a[] = {
{ai_charge, 10, NULL}, // Blaster attack
{ai_charge, 10, NULL},
{ai_charge, 10, NULL},
{ai_charge, 10, floater_fire_blaster}, // BOOM (0, -25.8, 32.5) -- LOOP Starts
{ai_charge, 10, floater_fire_blaster},
{ai_charge, 10, floater_fire_blaster},
{ai_charge, 10, floater_fire_blaster},
{ai_charge, 10, floater_fire_blaster},
{ai_charge, 10, floater_fire_blaster},
{ai_charge, 10, floater_fire_blaster},
{ai_charge, 10, NULL},
{ai_charge, 10, NULL},
{ai_charge, 10, NULL},
{ai_charge, 10, NULL} // -- LOOP Ends
};
mmove_t floater_move_attack1a = {
FRAME_attak101,
FRAME_attak114,
floater_frames_attack1a,
floater_run
};
mframe_t floater_frames_attack2[] = { mframe_t floater_frames_attack2[] = {
{ai_charge, 0, NULL}, /* Claws */ {ai_charge, 0, NULL}, /* Claws */
{ai_charge, 0, NULL}, {ai_charge, 0, NULL},
@ -640,7 +665,7 @@ floater_zap(edict_t *self)
gi.WriteByte(1); /* sparks */ gi.WriteByte(1); /* sparks */
gi.multicast(origin, MULTICAST_PVS); gi.multicast(origin, MULTICAST_PVS);
if (range(self, self->enemy) && infront(self, self->enemy) && if (range(self, self->enemy) == RANGE_MELEE && infront(self, self->enemy) &&
visible(self, self->enemy)) visible(self, self->enemy))
{ {
T_Damage(self->enemy, self, self, dir, self->enemy->s.origin, T_Damage(self->enemy, self, self, dir, self->enemy->s.origin,
@ -651,12 +676,41 @@ floater_zap(edict_t *self)
void void
floater_attack(edict_t *self) floater_attack(edict_t *self)
{ {
float chance;
if (!self) if (!self)
{ {
return; return;
} }
self->monsterinfo.currentmove = &floater_move_attack1; // 0% chance of circle in easy
// 50% chance in normal
// 75% chance in hard
// 86.67% chance in nightmare
if (!skill->value)
{
chance = 0;
}
else
{
chance = 1.0 - (0.5/(float)(skill->value));
}
if (random() > chance)
{
self->monsterinfo.attack_state = AS_STRAIGHT;
self->monsterinfo.currentmove = &floater_move_attack1;
}
else // circle strafe
{
if (random () <= 0.5) // switch directions
{
self->monsterinfo.lefty = 1 - self->monsterinfo.lefty;
}
self->monsterinfo.attack_state = AS_SLIDING;
self->monsterinfo.currentmove = &floater_move_attack1a;
}
} }
void void
@ -747,6 +801,22 @@ floater_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /*
BecomeExplosion1(self); BecomeExplosion1(self);
} }
qboolean
floater_blocked(edict_t *self, float dist)
{
if (!self)
{
return false;
}
if (blocked_checkshot(self, 0.25 + (0.05 * skill->value)))
{
return true;
}
return false;
}
/* /*
* QUAKED monster_floater (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight * QUAKED monster_floater (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
*/ */
@ -796,6 +866,7 @@ SP_monster_floater(edict_t *self)
self->monsterinfo.melee = floater_melee; self->monsterinfo.melee = floater_melee;
self->monsterinfo.sight = floater_sight; self->monsterinfo.sight = floater_sight;
self->monsterinfo.idle = floater_idle; self->monsterinfo.idle = floater_idle;
self->monsterinfo.blocked = floater_blocked;
gi.linkentity(self); gi.linkentity(self);

View file

@ -630,6 +630,7 @@ extern void flyer_pop_blades ( edict_t * self ) ;
extern void flyer_idle ( edict_t * self ) ; extern void flyer_idle ( edict_t * self ) ;
extern void flyer_sight ( edict_t * self , edict_t * other ) ; extern void flyer_sight ( edict_t * self , edict_t * other ) ;
extern void SP_monster_floater ( edict_t * self ) ; extern void SP_monster_floater ( edict_t * self ) ;
extern qboolean floater_blocked ( edict_t * self , float dist ) ;
extern void floater_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void floater_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ;
extern void floater_dead ( edict_t * self ) ; extern void floater_dead ( edict_t * self ) ;
extern void floater_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void floater_pain ( edict_t * self , edict_t * other , float kick , int damage ) ;

View file

@ -630,6 +630,7 @@
{"flyer_idle", (byte *)flyer_idle}, {"flyer_idle", (byte *)flyer_idle},
{"flyer_sight", (byte *)flyer_sight}, {"flyer_sight", (byte *)flyer_sight},
{"SP_monster_floater", (byte *)SP_monster_floater}, {"SP_monster_floater", (byte *)SP_monster_floater},
{"floater_blocked", (byte *)floater_blocked},
{"floater_die", (byte *)floater_die}, {"floater_die", (byte *)floater_die},
{"floater_dead", (byte *)floater_dead}, {"floater_dead", (byte *)floater_dead},
{"floater_pain", (byte *)floater_pain}, {"floater_pain", (byte *)floater_pain},

View file

@ -252,6 +252,7 @@ extern mmove_t floater_move_pain1 ;
extern mmove_t floater_move_death ; extern mmove_t floater_move_death ;
extern mmove_t floater_move_attack3 ; extern mmove_t floater_move_attack3 ;
extern mmove_t floater_move_attack2 ; extern mmove_t floater_move_attack2 ;
extern mmove_t floater_move_attack1a ;
extern mmove_t floater_move_attack1 ; extern mmove_t floater_move_attack1 ;
extern mmove_t floater_move_activate ; extern mmove_t floater_move_activate ;
extern mmove_t floater_move_stand2 ; extern mmove_t floater_move_stand2 ;

View file

@ -252,6 +252,7 @@
{"floater_move_death", &floater_move_death}, {"floater_move_death", &floater_move_death},
{"floater_move_attack3", &floater_move_attack3}, {"floater_move_attack3", &floater_move_attack3},
{"floater_move_attack2", &floater_move_attack2}, {"floater_move_attack2", &floater_move_attack2},
{"floater_move_attack1a", &floater_move_attack1a},
{"floater_move_attack1", &floater_move_attack1}, {"floater_move_attack1", &floater_move_attack1},
{"floater_move_activate", &floater_move_activate}, {"floater_move_activate", &floater_move_activate},
{"floater_move_stand2", &floater_move_stand2}, {"floater_move_stand2", &floater_move_stand2},