]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/mage.qc
Merge branch 'master' into Mario/killsound
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / mage.qc
index 650999de1eaf4c7c63e7b295d6b5a6143ed94fb7..251b1edc7ac786c27dde2df73c0e67b915c1ea12 100644 (file)
@@ -1,7 +1,5 @@
 #include "mage.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 
 SOUND(MageSpike_FIRE, W_Sound("electro_fire"));
@@ -164,7 +162,7 @@ void M_Mage_Attack_Spike_Think(entity this)
                // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
                if ((autocvar_g_monster_mage_attack_spike_smart) && vdist(eorg - this.origin, >, autocvar_g_monster_mage_attack_spike_smart_mindist))
                {
-                       // Is it a better idea (shorter distance) to trace to the target itthis?
+                       // Is it a better idea (shorter distance) to trace to the target itself?
                        if ( vlen2(this.origin + olddir * this.wait) < vlen2(eorg - this.origin))
                                traceline(this.origin, this.origin + olddir * this.wait, false, this);
                        else
@@ -201,6 +199,7 @@ void M_Mage_Attack_Spike(entity this, vector dir)
        set_movetype(missile, MOVETYPE_FLYMISSILE);
        missile.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, missile);
+       IL_PUSH(g_bot_dodge, missile);
        setorigin(missile, this.origin + v_forward * 14 + '0 0 30' + v_right * -14);
        setsize(missile, '0 0 0', '0 0 0');
        missile.velocity = dir * 400;
@@ -324,9 +323,8 @@ void M_Mage_Defend_Shield(entity this)
        this.anim_finished = time + 1;
 }
 
-bool M_Mage_Attack(int attack_type, entity actor, entity targ)
+bool M_Mage_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
 {
-    .entity weaponentity = weaponentities[0];
        switch(attack_type)
        {
                case MONSTER_ATTACK_MELEE:
@@ -372,7 +370,7 @@ bool M_Mage_Attack(int attack_type, entity actor, entity targ)
        return false;
 }
 
-spawnfunc(monster_mage) { Monster_Spawn(this, MON_MAGE.monsterid); }
+spawnfunc(monster_mage) { Monster_Spawn(this, true, MON_MAGE.monsterid); }
 
 #endif // SVQC
 
@@ -382,10 +380,9 @@ METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
     TC(Mage, thismon);
     bool need_help = false;
 
-    FOREACH_ENTITY_FLOAT(iscreature, true,
+    FOREACH_CLIENT(IS_PLAYER(it) && it != actor,
     {
-        if(it != actor)
-        if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
+       if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
         if(M_Mage_Defend_Heal_Check(actor, it))
         {
             need_help = true;
@@ -393,6 +390,19 @@ METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
         }
     });
 
+    if(!need_help)
+    {
+       IL_EACH(g_monsters, it != actor,
+       {
+               if(vdist(it.origin - actor.origin, <=, autocvar_g_monster_mage_heal_range))
+               if(M_Mage_Defend_Heal_Check(actor, it))
+               {
+                   need_help = true;
+                   break;
+               }
+       });
+    }
+
     if(actor.health < (autocvar_g_monster_mage_heal_minhealth) || need_help)
     if(time >= actor.attack_finished_single[0])
     if(random() < 0.5)
@@ -440,7 +450,6 @@ METHOD(Mage, mr_anim, bool(Mage this, entity actor))
 #endif
 #ifdef SVQC
 .float speed;
-spawnfunc(item_health_large);
 METHOD(Mage, mr_setup, bool(Mage this, entity actor))
 {
     TC(Mage, this);
@@ -450,7 +459,7 @@ METHOD(Mage, mr_setup, bool(Mage this, entity actor))
     if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_mage_speed_stop); }
     if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_mage_damageforcescale); }
 
-    actor.monster_loot = spawnfunc_item_health_large;
+    actor.monster_loot = ITEM_HealthBig;
     actor.monster_attackfunc = M_Mage_Attack;
 
     return true;
@@ -462,5 +471,3 @@ METHOD(Mage, mr_precache, bool(Mage this))
     return true;
 }
 #endif
-
-#endif