]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Delay shambler attacks separately so they're not spammed
authorMario <mario.mario@y7mail.com>
Sat, 12 Oct 2013 22:28:52 +0000 (09:28 +1100)
committerMario <mario.mario@y7mail.com>
Sat, 12 Oct 2013 22:28:52 +0000 (09:28 +1100)
qcsrc/common/monsters/monster/shambler.qc

index 68c2600d9cde5b71b8d32ea336a3a6b7260caf5c..7994f106a9037c43e758af5edf8184d8241f57a9 100644 (file)
@@ -38,6 +38,8 @@ const float shambler_anim_magic       = 6;
 const float shambler_anim_pain                 = 7;
 const float shambler_anim_death        = 8;
 
+.float shambler_lastattack; // delay attacks separately
+
 void shambler_smash()
 {
        makevectors(self.angles);
@@ -170,20 +172,25 @@ float shambler_attack(float attack_type)
                }
                case MONSTER_ATTACK_RANGED:
                {
+                       if(time >= self.shambler_lastattack) // shambler doesn't attack much
                        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;
+                               self.shambler_lastattack = time + 3;
+                               return TRUE;
                        }
-                       else
+                       else if(random() <= 0.1) // small chance, don't want this spammed
                        {
                                self.frame = shambler_anim_magic;
                                self.attack_finished_single = time + 1.1;
+                               self.shambler_lastattack = time + 3;
                                defer(0.6, shambler_lightning);
+                               return TRUE;
                        }
                        
-                       return TRUE;
+                       return FALSE;
                }
        }