/* fullname */ _("Mage")
);
-#define MAGE_SETTINGS(monster) \
- MON_ADD_CVAR(monster, health) \
- MON_ADD_CVAR(monster, attack_spike_damage) \
- MON_ADD_CVAR(monster, attack_spike_radius) \
- MON_ADD_CVAR(monster, attack_spike_delay) \
- MON_ADD_CVAR(monster, attack_spike_accel) \
- MON_ADD_CVAR(monster, attack_spike_decel) \
- MON_ADD_CVAR(monster, attack_spike_turnrate) \
- MON_ADD_CVAR(monster, attack_spike_speed_max) \
- MON_ADD_CVAR(monster, attack_spike_smart) \
- MON_ADD_CVAR(monster, attack_spike_smart_trace_min) \
- MON_ADD_CVAR(monster, attack_spike_smart_trace_max) \
- MON_ADD_CVAR(monster, attack_spike_smart_mindist) \
- MON_ADD_CVAR(monster, attack_push_damage) \
- MON_ADD_CVAR(monster, attack_push_radius) \
- MON_ADD_CVAR(monster, attack_push_delay) \
- MON_ADD_CVAR(monster, attack_push_force) \
- MON_ADD_CVAR(monster, heal_self) \
- MON_ADD_CVAR(monster, heal_allies) \
- MON_ADD_CVAR(monster, heal_minhealth) \
- MON_ADD_CVAR(monster, heal_range) \
- MON_ADD_CVAR(monster, heal_delay) \
- MON_ADD_CVAR(monster, shield_time) \
- MON_ADD_CVAR(monster, shield_delay) \
- MON_ADD_CVAR(monster, shield_blockpercent) \
- MON_ADD_CVAR(monster, speed_stop) \
- MON_ADD_CVAR(monster, speed_run) \
- MON_ADD_CVAR(monster, speed_walk)
-
-#ifdef SVQC
-MAGE_SETTINGS(mage)
-#endif // SVQC
#else
#ifdef SVQC
+float autocvar_g_monster_mage_health;
+float autocvar_g_monster_mage_attack_spike_damage;
+float autocvar_g_monster_mage_attack_spike_radius;
+float autocvar_g_monster_mage_attack_spike_delay;
+float autocvar_g_monster_mage_attack_spike_accel;
+float autocvar_g_monster_mage_attack_spike_decel;
+float autocvar_g_monster_mage_attack_spike_turnrate;
+float autocvar_g_monster_mage_attack_spike_speed_max;
+float autocvar_g_monster_mage_attack_spike_smart;
+float autocvar_g_monster_mage_attack_spike_smart_trace_min;
+float autocvar_g_monster_mage_attack_spike_smart_trace_max;
+float autocvar_g_monster_mage_attack_spike_smart_mindist;
+float autocvar_g_monster_mage_attack_push_damage;
+float autocvar_g_monster_mage_attack_push_radius;
+float autocvar_g_monster_mage_attack_push_delay;
+float autocvar_g_monster_mage_attack_push_force;
+float autocvar_g_monster_mage_heal_self;
+float autocvar_g_monster_mage_heal_allies;
+float autocvar_g_monster_mage_heal_minhealth;
+float autocvar_g_monster_mage_heal_range;
+float autocvar_g_monster_mage_heal_delay;
+float autocvar_g_monster_mage_shield_time;
+float autocvar_g_monster_mage_shield_delay;
+float autocvar_g_monster_mage_shield_blockpercent;
+float autocvar_g_monster_mage_speed_stop;
+float autocvar_g_monster_mage_speed_run;
+float autocvar_g_monster_mage_speed_walk;
+
const float mage_anim_idle = 0;
-const float mage_anim_walk = 1;
-const float mage_anim_attack = 2;
-const float mage_anim_pain = 3;
-const float mage_anim_death = 4;
+const float mage_anim_walk = 1;
+const float mage_anim_attack = 2;
+const float mage_anim_pain = 3;
+const float mage_anim_death = 4;
const float mage_anim_run = 5;
void() mage_heal;
float friend_needshelp(entity e)
{
if(e == world)
- return FALSE;
+ return false;
if(e.health <= 0)
- return FALSE;
+ return false;
if(DIFF_TEAM(e, self) && e != self.monster_owner)
- return FALSE;
+ return false;
if(e.frozen)
- return FALSE;
+ return false;
if(!IS_PLAYER(e))
- return (e.flags & FL_MONSTER && e.health < e.max_health);
+ return ((e.flags & FL_MONSTER) && e.health < e.max_health);
if(e.items & IT_INVINCIBLE)
- return FALSE;
+ return false;
switch(self.skin)
{
case 0: return (e.health < autocvar_g_balance_health_regenstable);
- case 1: return ((e.ammo_cells && e.ammo_cells < g_pickup_cells_max) || (e.ammo_rockets && e.ammo_rockets < g_pickup_rockets_max) || (e.ammo_nails && e.ammo_nails < g_pickup_nails_max) || (e.ammo_shells && e.ammo_shells < g_pickup_shells_max));
+ case 1: return ((e.ammo_cells && e.ammo_cells < g_pickup_cells_max) || (e.ammo_plasma && e.ammo_plasma < g_pickup_plasma_max) || (e.ammo_rockets && e.ammo_rockets < g_pickup_rockets_max) || (e.ammo_nails && e.ammo_nails < g_pickup_nails_max) || (e.ammo_shells && e.ammo_shells < g_pickup_shells_max));
case 2: return (e.armorvalue < autocvar_g_balance_armor_regenstable);
case 3: return (e.health > 0);
}
-
- return FALSE;
+
+ return false;
}
void mage_spike_explode()
{
self.event_damage = func_null;
-
+
sound(self, CH_SHOTS, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM);
-
+
self.realowner.mage_spike = world;
-
+
pointparticles(particleeffectnum("explosion_small"), self.origin, '0 0 0', 1);
- RadiusDamage (self, self.realowner, MON_CVAR(mage, attack_spike_damage), MON_CVAR(mage, attack_spike_damage) * 0.5, MON_CVAR(mage, attack_spike_radius), world, 0, DEATH_MONSTER_MAGE, other);
+ RadiusDamage (self, self.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, other);
remove (self);
}
spd = vlen(self.velocity);
spd = bound(
- spd - MON_CVAR(mage, attack_spike_decel) * frametime,
- MON_CVAR(mage, attack_spike_speed_max),
- spd + MON_CVAR(mage, attack_spike_accel) * frametime
+ 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 != world)
{
- e = self.enemy;
- eorg = 0.5 * (e.absmin + e.absmax);
- turnrate = MON_CVAR(mage, attack_spike_turnrate); // how fast to turn
- desireddir = normalize(eorg - self.origin);
- olddir = normalize(self.velocity); // get my current direction
- dist = vlen(eorg - self.origin);
+ e = self.enemy;
+ eorg = 0.5 * (e.absmin + e.absmax);
+ turnrate = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn
+ desireddir = normalize(eorg - self.origin);
+ olddir = normalize(self.velocity); // get my current direction
+ dist = vlen(eorg - self.origin);
// Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
- if (MON_CVAR(mage, attack_spike_smart) && (dist > MON_CVAR(mage, attack_spike_smart_mindist)))
+ if ((autocvar_g_monster_mage_attack_spike_smart) && (dist > (autocvar_g_monster_mage_attack_spike_smart_mindist)))
{
// Is it a better idea (shorter distance) to trace to the target itself?
if ( vlen(self.origin + olddir * self.wait) < dist)
- traceline(self.origin, self.origin + olddir * self.wait, FALSE, self);
+ traceline(self.origin, self.origin + olddir * self.wait, false, self);
else
- traceline(self.origin, eorg, FALSE, self);
+ traceline(self.origin, eorg, false, self);
// Setup adaptive tracelength
- self.wait = bound(MON_CVAR(mage, attack_spike_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = MON_CVAR(mage, attack_spike_smart_trace_max));
+ 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));
// 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);
+ desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
}
-
+
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
}
else
dist = 0;
-
+
///////////////
//self.angles = vectoangles(self.velocity); // turn model in the new flight direction
missile.movetype = MOVETYPE_FLYMISSILE;
missile.flags = FL_PROJECTILE;
setorigin(missile, self.origin + v_forward * 14 + '0 0 30' + v_right * -14);
- setsize (missile, '0 0 0', '0 0 0');
+ setsize (missile, '0 0 0', '0 0 0');
missile.velocity = dir * 400;
missile.avelocity = '300 300 300';
missile.enemy = self.enemy;
missile.touch = mage_spike_touch;
-
+
self.mage_spike = missile;
-
- CSQCProjectile(missile, TRUE, PROJECTILE_MAGE_SPIKE, TRUE);
+
+ CSQCProjectile(missile, true, PROJECTILE_MAGE_SPIKE, true);
}
void mage_heal()
{
entity head;
- float washealed = FALSE;
-
- for(head = findradius(self.origin, MON_CVAR(mage, heal_range)); head; head = head.chain) if(friend_needshelp(head))
+ float washealed = false;
+
+ for(head = findradius(self.origin, (autocvar_g_monster_mage_heal_range)); head; head = head.chain) if(friend_needshelp(head))
{
- washealed = TRUE;
+ washealed = true;
string fx = "";
if(IS_PLAYER(head))
{
switch(self.skin)
{
case 0:
- if(head.health < autocvar_g_balance_health_regenstable) head.health = bound(0, head.health + MON_CVAR(mage, heal_allies), autocvar_g_balance_health_regenstable);
+ 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);
fx = "healing_fx";
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);
case 2:
if(head.armorvalue < autocvar_g_balance_armor_regenstable)
{
- head.armorvalue = bound(0, head.armorvalue + MON_CVAR(mage, heal_allies), autocvar_g_balance_armor_regenstable);
+ head.armorvalue = bound(0, head.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 == self) ? MON_CVAR(mage, heal_self) : MON_CVAR(mage, heal_allies)), autocvar_g_balance_health_regenstable);
+ head.health = bound(0, head.health - ((head == self) ? (autocvar_g_monster_mage_heal_self) : (autocvar_g_monster_mage_heal_allies)), autocvar_g_balance_health_regenstable);
fx = "rage";
break;
}
-
+
pointparticles(particleeffectnum(fx), head.origin, '0 0 0', 1);
}
else
{
pointparticles(particleeffectnum("healing_fx"), head.origin, '0 0 0', 1);
- head.health = bound(0, head.health + MON_CVAR(mage, heal_allies), head.max_health);
- WaypointSprite_UpdateHealth(head.sprite, head.health);
+ head.health = bound(0, head.health + (autocvar_g_monster_mage_heal_allies), head.max_health);
+ if(!(head.spawnflags & MONSTERFLAG_INVINCIBLE))
+ WaypointSprite_UpdateHealth(head.sprite, head.health);
}
}
-
+
if(washealed)
{
self.frame = mage_anim_attack;
- self.attack_finished_single = time + MON_CVAR(mage, heal_delay);
+ self.attack_finished_single = time + (autocvar_g_monster_mage_heal_delay);
}
}
void mage_push()
{
sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTEN_NORM);
- RadiusDamage (self, self, MON_CVAR(mage, attack_push_damage), MON_CVAR(mage, attack_push_damage), MON_CVAR(mage, attack_push_radius), world, MON_CVAR(mage, attack_push_force), DEATH_MONSTER_MAGE, self.enemy);
+ RadiusDamage (self, self, (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, self.enemy);
pointparticles(particleeffectnum("TE_EXPLOSION"), self.origin, '0 0 0', 1);
-
+
self.frame = mage_anim_attack;
- self.attack_finished_single = time + MON_CVAR(mage, attack_push_delay);
+ self.attack_finished_single = time + (autocvar_g_monster_mage_attack_push_delay);
}
void mage_teleport()
makevectors(self.enemy.angles);
tracebox(self.enemy.origin + ((v_forward * -1) * 200), self.mins, self.maxs, self.origin, MOVE_NOMONSTERS, self);
-
+
if(trace_fraction < 1)
return;
-
+
pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1);
setorigin(self, self.enemy.origin + ((v_forward * -1) * 200));
-
+
self.attack_finished_single = time + 0.2;
}
void mage_shield()
{
self.effects |= (EF_ADDITIVE | EF_BLUE);
- self.lastshielded = time + MON_CVAR(mage, shield_delay);
- self.m_armor_blockpercent = MON_CVAR(mage, shield_blockpercent);
+ self.lastshielded = time + (autocvar_g_monster_mage_shield_delay);
+ self.m_armor_blockpercent = (autocvar_g_monster_mage_shield_blockpercent);
self.armorvalue = self.health;
- self.shield_ltime = time + MON_CVAR(mage, shield_time);
+ self.shield_ltime = time + (autocvar_g_monster_mage_shield_time);
self.frame = mage_anim_attack;
self.attack_finished_single = time + 1;
}
if(random() <= 0.7)
{
mage_push();
- return TRUE;
+ return true;
}
-
- return FALSE;
+
+ return false;
}
case MONSTER_ATTACK_RANGED:
{
- if not(self.mage_spike)
+ if(!self.mage_spike)
{
if(random() <= 0.4)
{
mage_teleport();
- return TRUE;
+ return true;
}
else
{
self.frame = mage_anim_attack;
- self.attack_finished_single = time + MON_CVAR(mage, attack_spike_delay);
+ self.attack_finished_single = time + (autocvar_g_monster_mage_attack_spike_delay);
defer(0.2, mage_attack_spike);
- return TRUE;
+ return true;
}
}
-
+
if(self.mage_spike)
- return TRUE;
+ return true;
else
- return FALSE;
+ return false;
}
}
-
- return FALSE;
+
+ return false;
}
void spawnfunc_monster_mage()
{
self.classname = "monster_mage";
-
- self.monster_spawnfunc = spawnfunc_monster_mage;
-
- if(Monster_CheckAppearFlags(self))
- return;
-
- if not(monster_initialize(MON_MAGE, FALSE)) { remove(self); return; }
+
+ if(!monster_initialize(MON_MAGE)) { remove(self); return; }
}
// compatibility with old spawns
case MR_THINK:
{
entity head;
- float need_help = FALSE;
-
- for(head = findradius(self.origin, MON_CVAR(mage, heal_range)); head; head = head.chain)
+ float need_help = false;
+
+ for(head = findradius(self.origin, (autocvar_g_monster_mage_heal_range)); head; head = head.chain)
if(head != self)
if(friend_needshelp(head))
{
- need_help = TRUE;
+ need_help = true;
break;
}
-
- if(self.health < MON_CVAR(mage, heal_minhealth) || need_help)
+
+ if(self.health < (autocvar_g_monster_mage_heal_minhealth) || need_help)
if(time >= self.attack_finished_single)
if(random() < 0.5)
mage_heal();
-
+
if(time >= self.shield_ltime && self.armorvalue)
mage_shield_remove();
-
+
if(self.enemy)
if(self.health < self.max_health)
if(time >= self.lastshielded)
if(random() < 0.5)
mage_shield();
-
- monster_move(MON_CVAR(mage, speed_run), MON_CVAR(mage, speed_walk), MON_CVAR(mage, speed_stop), mage_anim_walk, mage_anim_run, mage_anim_idle);
- return TRUE;
+
+ monster_move((autocvar_g_monster_mage_speed_run), (autocvar_g_monster_mage_speed_walk), (autocvar_g_monster_mage_speed_stop), mage_anim_walk, mage_anim_run, mage_anim_idle);
+ return true;
}
case MR_DEATH:
{
self.frame = mage_anim_death;
- return TRUE;
+ return true;
}
case MR_SETUP:
{
- if not(self.health) self.health = MON_CVAR(mage, health);
-
+ if(!self.health) self.health = (autocvar_g_monster_mage_health);
+
self.monster_loot = spawnfunc_item_health_large;
self.monster_attackfunc = mage_attack;
self.frame = mage_anim_walk;
-
- return TRUE;
+
+ return true;
}
case MR_PRECACHE:
{
- precache_model ("models/monsters/mage.dpm");
+ precache_model("models/monsters/mage.dpm");
precache_sound ("weapons/grenade_impact.wav");
precache_sound ("weapons/tagexp1.wav");
- return TRUE;
- }
- case MR_CONFIG:
- {
- MON_CONFIG_SETTINGS(MAGE_SETTINGS(mage))
- return TRUE;
+ return true;
}
}
-
- return TRUE;
+
+ return true;
}
#endif // SVQC
{
case MR_PRECACHE:
{
- precache_model ("models/monsters/mage.dpm");
- return TRUE;
+ return true;
}
}
-
- return TRUE;
+
+ return true;
}
#endif // CSQC