X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fmage.qc;h=c964b30827141bb9117abf762c4d1608bdf1c1f4;hb=fc15d72b041c9a748b605ba28735380fbe5b5b01;hp=66ea47f251abd8681c3bbe716cfd77a207a49e98;hpb=66189615a05cc66dd0ee544a2bbc841c4f426193;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 66ea47f25..c964b3082 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -122,7 +122,7 @@ void M_Mage_Defend_Shield(entity this); bool M_Mage_Defend_Heal_Check(entity this, entity targ) { - if(targ == world) + if(targ == NULL) return false; if(targ.health <= 0) return false; @@ -152,76 +152,75 @@ void M_Mage_Attack_Spike_Explode(entity this) sound(this, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); - this.realowner.mage_spike = world; + this.realowner.mage_spike = NULL; Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1); - RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), world, world, 0, DEATH_MONSTER_MAGE.m_id, other); + RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, other); remove (this); } -void M_Mage_Attack_Spike_Touch() +void M_Mage_Attack_Spike_Touch(entity this) { - SELFPARAM(); - PROJECTILE_TOUCH; + PROJECTILE_TOUCH(this); - M_Mage_Attack_Spike_Explode(self); + M_Mage_Attack_Spike_Explode(this); } .float wait; // copied from W_Seeker_Think -void M_Mage_Attack_Spike_Think() -{SELFPARAM(); - if (time > self.ltime || (self.enemy && self.enemy.health <= 0) || self.owner.health <= 0) { - self.projectiledeathtype |= HITTYPE_SPLASH; - M_Mage_Attack_Spike_Explode(self); +void M_Mage_Attack_Spike_Think(entity this) +{ + if (time > this.ltime || (this.enemy && this.enemy.health <= 0) || this.owner.health <= 0) { + this.projectiledeathtype |= HITTYPE_SPLASH; + M_Mage_Attack_Spike_Explode(this); } - float spd = vlen(self.velocity); + float spd = vlen(this.velocity); spd = bound( spd - (autocvar_g_monster_mage_attack_spike_decel) * frametime, (autocvar_g_monster_mage_attack_spike_speed_max), spd + (autocvar_g_monster_mage_attack_spike_accel) * frametime ); - if (self.enemy != world) - if (self.enemy.takedamage != DAMAGE_AIM || IS_DEAD(self.enemy)) - self.enemy = world; + if (this.enemy != NULL) + if (this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy)) + this.enemy = NULL; - if (self.enemy != world) + if (this.enemy != NULL) { - entity e = self.enemy; + entity e = this.enemy; vector eorg = 0.5 * (e.absmin + e.absmax); float turnrate = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn - vector desireddir = normalize(eorg - self.origin); - vector olddir = normalize(self.velocity); // get my current direction + vector desireddir = normalize(eorg - this.origin); + vector olddir = normalize(this.velocity); // get my current direction // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P ) - if ((autocvar_g_monster_mage_attack_spike_smart) && vdist(eorg - self.origin, >, autocvar_g_monster_mage_attack_spike_smart_mindist)) + 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 itself? - if ( vlen2(self.origin + olddir * self.wait) < vlen2(eorg - self.origin)) - traceline(self.origin, self.origin + olddir * self.wait, false, self); + // Is it a better idea (shorter distance) to trace to the target itthis? + if ( vlen2(this.origin + olddir * this.wait) < vlen2(eorg - this.origin)) + traceline(this.origin, this.origin + olddir * this.wait, false, this); else - traceline(self.origin, eorg, false, self); + traceline(this.origin, eorg, false, this); // Setup adaptive tracelength - self.wait = bound((autocvar_g_monster_mage_attack_spike_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = (autocvar_g_monster_mage_attack_spike_smart_trace_max)); + this.wait = bound((autocvar_g_monster_mage_attack_spike_smart_trace_min), vlen(this.origin - trace_endpos), this.wait = (autocvar_g_monster_mage_attack_spike_smart_trace_max)); // Calc how important it is that we turn and add this to the desierd (enemy) dir. desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5); } vector newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy - self.velocity = newdir * spd; // make me fly in the new direction at my flight speed + this.velocity = newdir * spd; // make me fly in the new direction at my flight speed } /////////////// - //self.angles = vectoangles(self.velocity); // turn model in the new flight direction - self.nextthink = time;// + 0.05; // csqc projectiles - UpdateCSQCProjectile(self); + //this.angles = vectoangles(this.velocity); // turn model in the new flight direction + this.nextthink = time;// + 0.05; // csqc projectiles + UpdateCSQCProjectile(this); } void M_Mage_Attack_Spike(entity this, vector dir) @@ -230,7 +229,7 @@ void M_Mage_Attack_Spike(entity this, vector dir) entity missile = spawn(); missile.owner = missile.realowner = this; - missile.think = M_Mage_Attack_Spike_Think; + setthink(missile, M_Mage_Attack_Spike_Think); missile.ltime = time + 7; missile.nextthink = time; missile.solid = SOLID_BBOX; @@ -241,7 +240,7 @@ void M_Mage_Attack_Spike(entity this, vector dir) missile.velocity = dir * 400; missile.avelocity = '300 300 300'; missile.enemy = this.enemy; - missile.touch = M_Mage_Attack_Spike_Touch; + settouch(missile, M_Mage_Attack_Spike_Touch); this.mage_spike = missile; @@ -250,52 +249,51 @@ void M_Mage_Attack_Spike(entity this, vector dir) void M_Mage_Defend_Heal(entity this) { - entity head; float washealed = false; - for(head = findradius(this.origin, (autocvar_g_monster_mage_heal_range)); head; head = head.chain) if(M_Mage_Defend_Heal_Check(this, head)) + FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_mage_heal_range, M_Mage_Defend_Heal_Check(this, it), { washealed = true; string fx = ""; - if(IS_PLAYER(head)) + if(IS_PLAYER(it)) { switch(this.skin) { case 0: - if(head.health < autocvar_g_balance_health_regenstable) head.health = bound(0, head.health + (autocvar_g_monster_mage_heal_allies), autocvar_g_balance_health_regenstable); + if(it.health < autocvar_g_balance_health_regenstable) it.health = bound(0, it.health + (autocvar_g_monster_mage_heal_allies), autocvar_g_balance_health_regenstable); fx = EFFECT_HEALING.eent_eff_name; break; case 1: - if(head.ammo_cells) head.ammo_cells = bound(head.ammo_cells, head.ammo_cells + 1, g_pickup_cells_max); - if(head.ammo_plasma) head.ammo_plasma = bound(head.ammo_plasma, head.ammo_plasma + 1, g_pickup_plasma_max); - if(head.ammo_rockets) head.ammo_rockets = bound(head.ammo_rockets, head.ammo_rockets + 1, g_pickup_rockets_max); - if(head.ammo_shells) head.ammo_shells = bound(head.ammo_shells, head.ammo_shells + 2, g_pickup_shells_max); - if(head.ammo_nails) head.ammo_nails = bound(head.ammo_nails, head.ammo_nails + 5, g_pickup_nails_max); + if(it.ammo_cells) it.ammo_cells = bound(it.ammo_cells, it.ammo_cells + 1, g_pickup_cells_max); + if(it.ammo_plasma) it.ammo_plasma = bound(it.ammo_plasma, it.ammo_plasma + 1, g_pickup_plasma_max); + if(it.ammo_rockets) it.ammo_rockets = bound(it.ammo_rockets, it.ammo_rockets + 1, g_pickup_rockets_max); + if(it.ammo_shells) it.ammo_shells = bound(it.ammo_shells, it.ammo_shells + 2, g_pickup_shells_max); + if(it.ammo_nails) it.ammo_nails = bound(it.ammo_nails, it.ammo_nails + 5, g_pickup_nails_max); fx = "ammoregen_fx"; break; case 2: - if(head.armorvalue < autocvar_g_balance_armor_regenstable) + if(it.armorvalue < autocvar_g_balance_armor_regenstable) { - head.armorvalue = bound(0, head.armorvalue + (autocvar_g_monster_mage_heal_allies), autocvar_g_balance_armor_regenstable); + it.armorvalue = bound(0, it.armorvalue + (autocvar_g_monster_mage_heal_allies), autocvar_g_balance_armor_regenstable); fx = "armorrepair_fx"; } break; case 3: - head.health = bound(0, head.health - ((head == this) ? (autocvar_g_monster_mage_heal_self) : (autocvar_g_monster_mage_heal_allies)), autocvar_g_balance_health_regenstable); + it.health = bound(0, it.health - ((it == this) ? (autocvar_g_monster_mage_heal_self) : (autocvar_g_monster_mage_heal_allies)), autocvar_g_balance_health_regenstable); fx = EFFECT_RAGE.eent_eff_name; break; } - Send_Effect_(fx, head.origin, '0 0 0', 1); + Send_Effect_(fx, it.origin, '0 0 0', 1); } else { - Send_Effect(EFFECT_HEALING, head.origin, '0 0 0', 1); - head.health = bound(0, head.health + (autocvar_g_monster_mage_heal_allies), head.max_health); - if(!(head.spawnflags & MONSTERFLAG_INVINCIBLE) && head.sprite) - WaypointSprite_UpdateHealth(head.sprite, head.health); + Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1); + it.health = bound(0, it.health + (autocvar_g_monster_mage_heal_allies), it.max_health); + if(!(it.spawnflags & MONSTERFLAG_INVINCIBLE) && it.sprite) + WaypointSprite_UpdateHealth(it.sprite, it.health); } - } + }); if(washealed) { @@ -308,7 +306,7 @@ void M_Mage_Defend_Heal(entity this) void M_Mage_Attack_Push(entity this) { sound(this, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM); - RadiusDamage (this, this, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE.m_id, this.enemy); + RadiusDamage (this, this, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), NULL, NULL, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE.m_id, this.enemy); Send_Effect(EFFECT_TE_EXPLOSION, this.origin, '0 0 0', 1); setanim(this, this.anim_shoot, true, true, true); @@ -446,10 +444,10 @@ METHOD(Mage, mr_think, bool(Mage thismon, entity actor)) return true; } -METHOD(Mage, mr_pain, bool(Mage this, entity actor)) +METHOD(Mage, mr_pain, float(Mage this, entity actor, float damage_take, entity attacker, float deathtype)) { TC(Mage, this); - return true; + return damage_take; } METHOD(Mage, mr_death, bool(Mage this, entity actor))