]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Replace shambler attacks
authorMario <mario.mario@y7mail.com>
Sat, 12 Oct 2013 22:23:17 +0000 (09:23 +1100)
committerMario <mario.mario@y7mail.com>
Sat, 12 Oct 2013 22:23:17 +0000 (09:23 +1100)
monsters.cfg
qcsrc/client/projectile.qc
qcsrc/common/constants.qh
qcsrc/common/monsters/monster/shambler.qc

index e9771c0dcb224cdfc201bc0d8815b0ad89ce0c0e..2aa5f4dd5b6f63ca956681cd744571962284bead 100644 (file)
@@ -63,6 +63,11 @@ set g_monster_wyvern_speed_walk 40
 // {{{ #5: Shambler
 set g_monster_shambler_attack_claw_damage 50
 set g_monster_shambler_attack_lightning_damage 15
+set g_monster_shambler_attack_lightning_force 100
+set g_monster_shambler_attack_lightning_radius 50
+set g_monster_shambler_attack_lightning_radius_zap 250
+set g_monster_shambler_attack_lightning_speed 800
+set g_monster_shambler_attack_lightning_speed_up 150
 set g_monster_shambler_attack_smash_damage 50
 set g_monster_shambler_health 500
 set g_monster_shambler_speed_run 150
index c61f07cacc103c0e6c58e8b6f9188a74a3a2f20d..f11a94f8a3e229b50cd4575ca33739dcb379e75b 100644 (file)
@@ -315,6 +315,7 @@ void Ent_Projectile()
                        case PROJECTILE_SEEKER: setmodel(self, "models/tagrocket.md3"); self.traileffect = particleeffectnum("TR_SEEKER"); break;
                        
                        case PROJECTILE_MAGE_SPIKE: setmodel(self, "models/ebomb.mdl"); self.traileffect = particleeffectnum("TR_VORESPIKE"); break;
+                       case PROJECTILE_SHAMBLER_LIGHTNING: setmodel(self, "models/ebomb.mdl"); self.traileffect = particleeffectnum("TR_NEXUIZPLASMA"); break;
 
                        case PROJECTILE_RAPTORBOMB:    setmodel(self, "models/vehicles/clusterbomb.md3"); self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = particleeffectnum(""); break;
                        case PROJECTILE_RAPTORBOMBLET: setmodel(self, "models/vehicles/bomblet.md3");     self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = particleeffectnum(""); break;
@@ -407,6 +408,14 @@ void Ent_Projectile()
                                self.scale = 1.5;
                                self.avelocity = randomvec() * 720;
                                break;
+                       case PROJECTILE_SHAMBLER_LIGHTNING:
+                               self.mins = '-8 -8 -8';
+                               self.maxs = '8 8 8';
+                               self.move_movetype = MOVETYPE_BOUNCE;
+                               self.move_touch = func_null;
+                               self.scale = 2.5;
+                               self.avelocity = randomvec() * 720;
+                               break;
                        case PROJECTILE_MINE:
                                self.mins = '-4 -4 -4';
                                self.maxs = '4 4 4';
index 13b8b8a5288562aa3fdc2a96f094f34186657f13..e3c461fa12fa753f10c35c9bd4b2bc82446c220d 100644 (file)
@@ -362,6 +362,7 @@ const float PROJECTILE_BUMBLE_GUN = 30;
 const float PROJECTILE_BUMBLE_BEAM = 31;
 
 float PROJECTILE_MAGE_SPIKE = 32;
+float PROJECTILE_SHAMBLER_LIGHTNING = 33;
 
 const float PROJECTILE_NADE_RED = 50;
 const float PROJECTILE_NADE_RED_BURN = 51;
index 0ea8924b6a41f43d33082a080565965f93a96864..68c2600d9cde5b71b8d32ea336a3a6b7260caf5c 100644 (file)
@@ -14,6 +14,11 @@ REGISTER_MONSTER(
        MON_ADD_CVAR(monster, attack_smash_damage) \
        MON_ADD_CVAR(monster, attack_claw_damage) \
        MON_ADD_CVAR(monster, attack_lightning_damage) \
+       MON_ADD_CVAR(monster, attack_lightning_force) \
+       MON_ADD_CVAR(monster, attack_lightning_radius) \
+       MON_ADD_CVAR(monster, attack_lightning_radius_zap) \
+       MON_ADD_CVAR(monster, attack_lightning_speed) \
+       MON_ADD_CVAR(monster, attack_lightning_speed_up) \
        MON_ADD_CVAR(monster, speed_stop) \
        MON_ADD_CVAR(monster, speed_run) \
        MON_ADD_CVAR(monster, speed_walk) 
@@ -35,14 +40,14 @@ const float shambler_anim_death     = 8;
 
 void shambler_smash()
 {
-       monster_melee(self.enemy, MON_CVAR(shambler, attack_smash_damage), shambler_anim_smash, self.attack_range, 0.4, DEATH_MONSTER_SHAMBLER_SMASH, TRUE);
-}
-
-void shambler_delayedsmash()
-{
-       self.frame = shambler_anim_smash;
-       defer(0.7, shambler_smash);
-       self.attack_finished_single = time + 1.1;
+       makevectors(self.angles);
+       pointparticles(particleeffectnum("explosion_medium"), (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs_z), '0 0 0', 1);
+       sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
+       
+       tracebox(self.origin + v_forward * 50, self.mins * 0.5, self.maxs * 0.5, self.origin + v_forward * 500, MOVE_NORMAL, self);
+       
+       if(trace_ent.takedamage)
+               Damage(trace_ent, self, self, MON_CVAR(shambler, attack_smash_damage) * Monster_SkillModifier(), DEATH_MONSTER_SHAMBLER_SMASH, trace_ent.origin, normalize(trace_ent.origin - self.origin));
 }
 
 void shambler_swing()
@@ -50,30 +55,108 @@ void shambler_swing()
        float r = (random() < 0.5);
        monster_melee(self.enemy, MON_CVAR(shambler, attack_claw_damage), ((r) ? shambler_anim_swingr : shambler_anim_swingl), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, TRUE);
        if(r)
+       {
                defer(0.5, shambler_swing);
+               self.attack_finished_single += 0.5;
+       }
 }
 
-void CastLightning()
+void shambler_lightning_explode()
 {
-       local vector org, dir;
-       //vector v = '0 0 0';
+       entity head;
+       
+       sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTEN_NORM);
+       pointparticles(particleeffectnum("electro_impact"), '0 0 0', '0 0 0', 1);
 
-       self.effects |= EF_MUZZLEFLASH;
+       self.event_damage = func_null;
+       self.takedamage = DAMAGE_NO;
+       self.movetype = MOVETYPE_NONE;
+       self.velocity = '0 0 0';
+       UpdateCSQCProjectile(self);
 
-       org = self.origin + '0 0 40';
+       if(self.movetype == MOVETYPE_NONE)
+               self.velocity = self.oldvelocity;
 
-       dir = self.enemy.origin + '0 0 16' - org;
-       dir = normalize (dir);
+       RadiusDamage (self, self.realowner, MON_CVAR(shambler, attack_lightning_damage), MON_CVAR(shambler, attack_lightning_damage), MON_CVAR(shambler, attack_lightning_radius), world, MON_CVAR(shambler, attack_lightning_force), self.projectiledeathtype, other);
+       
+       for(head = findradius(self.origin, MON_CVAR(shambler, attack_lightning_radius_zap)); head; head = head.chain) if(head != self.realowner)
+       {
+               te_csqc_lightningarc(self.origin, head.origin);
+               Damage(head, self, self.realowner, MON_CVAR(shambler, attack_lightning_damage) * Monster_SkillModifier(), DEATH_MONSTER_SHAMBLER_ZAP, head.origin, '0 0 0');
+       }
+
+       self.think = SUB_Remove;
+       self.nextthink = time + 0.2;
+}
 
-       traceline (org, self.origin + dir * 1000, TRUE, self);
+void shambler_lightning_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+       if (self.health <= 0)
+               return;
                
-       FireRailgunBullet (org, org + dir * 1000, MON_CVAR(shambler, attack_lightning_damage) * Monster_SkillModifier(), 0, 0, 0, 0, 0, DEATH_MONSTER_SHAMBLER_ZAP);
+       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+               return; // g_projectiles_damage says to halt
+               
+       self.health = self.health - damage;
+       
+       if (self.health <= 0)
+               W_PrepareExplosionByDamage(attacker, self.use);
+}
+
+void shambler_lightning_touch()
+{
+       PROJECTILE_TOUCH;
        
-       // teamcolor / hit beam effect
-       //v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
-       //WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), org, v);
+       self.use ();
+}
+
+void shambler_lightning_think()
+{
+       self.nextthink = time;
+       if (time > self.cnt)
+       {
+               other = world;
+               shambler_lightning_explode();
+               return;
+       }
+}
+
+void shambler_lightning()
+{
+       entity gren;
        
-       te_csqc_lightningarc(org, trace_endpos);
+       monster_makevectors(self.enemy);
+
+       gren = spawn ();
+       gren.owner = gren.realowner = self;
+       gren.classname = "grenade";
+       gren.bot_dodge = TRUE;
+       gren.bot_dodgerating = MON_CVAR(shambler, attack_lightning_damage);
+       gren.movetype = MOVETYPE_BOUNCE;
+       PROJECTILE_MAKETRIGGER(gren);
+       gren.projectiledeathtype = DEATH_MONSTER_SHAMBLER_ZAP;
+       setorigin(gren, CENTER_OR_VIEWOFS(self));
+       setsize(gren, '-8 -8 -8', '8 8 8');
+       gren.scale = 2.5;
+
+       gren.cnt = time + 5;
+       gren.nextthink = time;
+       gren.think = shambler_lightning_think;
+       gren.use = shambler_lightning_explode;
+       gren.touch = shambler_lightning_touch;
+
+       gren.takedamage = DAMAGE_YES;
+       gren.health = 50;
+       gren.damageforcescale = 0;
+       gren.event_damage = shambler_lightning_damage;
+       gren.damagedbycontents = TRUE;
+       gren.missile_flags = MIF_SPLASH | MIF_ARC;
+       W_SetupProjectileVelocityEx(gren, v_forward, v_up, MON_CVAR(shambler, attack_lightning_speed), MON_CVAR(shambler, attack_lightning_speed_up), 0, 0, FALSE);
+
+       gren.angles = vectoangles (gren.velocity);
+       gren.flags = FL_PROJECTILE;
+
+       CSQCProjectile(gren, TRUE, PROJECTILE_SHAMBLER_LIGHTNING, TRUE);
 }
 
 float shambler_attack(float attack_type)
@@ -82,20 +165,23 @@ float shambler_attack(float attack_type)
        {
                case MONSTER_ATTACK_MELEE:
                {
-                       float chance = random();
-
-                       if(chance > 0.6)
-                               shambler_delayedsmash();
-                       else
-                               shambler_swing();
-                       
+                       shambler_swing();
                        return TRUE;
                }
                case MONSTER_ATTACK_RANGED:
                {
-                       self.frame = shambler_anim_magic;
-                       self.attack_finished_single = time + 1.1;
-                       defer(0.6, CastLightning);
+                       if(random() <= 0.5 && vlen(self.enemy.origin - self.origin) <= 500)
+                       {
+                               self.frame = shambler_anim_smash;
+                               defer(0.7, shambler_smash);
+                               self.attack_finished_single = time + 1.1;
+                       }
+                       else
+                       {
+                               self.frame = shambler_anim_magic;
+                               self.attack_finished_single = time + 1.1;
+                               defer(0.6, shambler_lightning);
+                       }
                        
                        return TRUE;
                }