X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fmage.qc;h=650999de1eaf4c7c63e7b295d6b5a6143ed94fb7;hb=e424ba544c41fc40b241b17bd7c1d9c2fc930705;hp=5b7bf3a56a512101e07ca5fafcfeb97fc6d633b9;hpb=1a9e7607796f021c85d200ce66bdfb7f3932d882;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 5b7bf3a56..650999de1 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -1,39 +1,4 @@ -#ifndef MAGE_H -#define MAGE_H - -#ifndef MENUQC -MODEL(MON_MAGE, M_Model("mage.dpm")); -#endif - -CLASS(Mage, Monster) - ATTRIB(Mage, spawnflags, int, MON_FLAG_MELEE | MON_FLAG_RANGED); - ATTRIB(Mage, mins, vector, '-36 -36 -24'); - ATTRIB(Mage, maxs, vector, '36 36 50'); -#ifndef MENUQC - ATTRIB(Mage, m_model, Model, MDL_MON_MAGE); -#endif - ATTRIB(Mage, netname, string, "mage"); - ATTRIB(Mage, monster_name, string, _("Mage")); -ENDCLASS(Mage) - -REGISTER_MONSTER(MAGE, NEW(Mage)) { -#ifndef MENUQC - this.mr_precache(this); -#endif -} - -#include -#include - -CLASS(MageSpike, PortoLaunch) -/* flags */ ATTRIB(MageSpike, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED); -/* impulse */ ATTRIB(MageSpike, impulse, int, 9); -/* refname */ ATTRIB(MageSpike, netname, string, "magespike"); -/* wepname */ ATTRIB(MageSpike, m_name, string, _("Mage spike")); -ENDCLASS(MageSpike) -REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike)); - -#endif +#include "mage.qh" #ifdef IMPLEMENTATION @@ -49,7 +14,7 @@ METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, .entity weapon if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) { if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range; actor.enemy = Monster_FindTarget(actor); - W_SetupShot_Dir(actor, v_forward, false, 0, SND_MageSpike_FIRE, CH_WEAPON_B, 0); + W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_MageSpike_FIRE, CH_WEAPON_B, 0); if (!IS_PLAYER(actor)) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin); M_Mage_Attack_Spike(actor, w_shotdir); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready); @@ -122,7 +87,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; @@ -146,25 +111,25 @@ bool M_Mage_Defend_Heal_Check(entity this, entity targ) return false; } -void M_Mage_Attack_Spike_Explode(entity this) +void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity) { this.event_damage = func_null; 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, directhitentity); - remove (this); + delete (this); } -void M_Mage_Attack_Spike_Touch(entity this) +void M_Mage_Attack_Spike_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); - M_Mage_Attack_Spike_Explode(self); + M_Mage_Attack_Spike_Explode(this, toucher); } .float wait; @@ -174,7 +139,7 @@ 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); + M_Mage_Attack_Spike_Explode(this, NULL); } float spd = vlen(this.velocity); @@ -184,11 +149,11 @@ void M_Mage_Attack_Spike_Think(entity this) spd + (autocvar_g_monster_mage_attack_spike_accel) * frametime ); - if (this.enemy != world) + if (this.enemy != NULL) if (this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy)) - this.enemy = world; + this.enemy = NULL; - if (this.enemy != world) + if (this.enemy != NULL) { entity e = this.enemy; vector eorg = 0.5 * (e.absmin + e.absmax); @@ -233,8 +198,9 @@ void M_Mage_Attack_Spike(entity this, vector dir) missile.ltime = time + 7; missile.nextthink = time; missile.solid = SOLID_BBOX; - missile.movetype = MOVETYPE_FLYMISSILE; + set_movetype(missile, MOVETYPE_FLYMISSILE); missile.flags = FL_PROJECTILE; + IL_PUSH(g_projectiles, 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; @@ -249,52 +215,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) { @@ -307,7 +272,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); @@ -445,10 +410,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)) @@ -459,7 +424,7 @@ METHOD(Mage, mr_death, bool(Mage this, entity actor)) } #endif -#ifndef MENUQC +#ifdef GAMEQC METHOD(Mage, mr_anim, bool(Mage this, entity actor)) { TC(Mage, this);