From: Mario Date: Wed, 5 Jun 2013 20:10:27 +0000 (+1000) Subject: Add new healing abilities for mage & lower self healing amount X-Git-Tag: xonotic-v0.8.0~241^2^2~195 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cc32a8d2ed8bdd79ef42a548607590ae72cadfe7;p=xonotic%2Fxonotic-data.pk3dir.git Add new healing abilities for mage & lower self healing amount --- diff --git a/monsters.cfg b/monsters.cfg index d39732507..65890643f 100644 --- a/monsters.cfg +++ b/monsters.cfg @@ -153,7 +153,7 @@ set g_monster_mage_attack_spike_radius 60 "Mage homing spike explosion radius" set g_monster_mage_attack_spike_delay 2 "Delay between Mage homing spike attacks" set g_monster_mage_attack_melee_damage 30 "Mage magic attack damage" set g_monster_mage_attack_melee_delay 0.7 "Delay between Mage melee attacks" -set g_monster_mage_heal_self 50 "Amount of health Mage will regenerate every attack when its low on health" +set g_monster_mage_heal_self 35 "Amount of health Mage will regenerate every attack when its low on health" set g_monster_mage_heal_friends 15 "Amount of health Mage will regenerate nearby friends" set g_monster_mage_heal_minhealth 250 "Health limit below which Mage will try to heal itself" set g_monster_mage_heal_range 200 "Maximum healing distance" diff --git a/qcsrc/server/monsters/monster/mage.qc b/qcsrc/server/monsters/monster/mage.qc index 13198e6c7..740052ff6 100644 --- a/qcsrc/server/monsters/monster/mage.qc +++ b/qcsrc/server/monsters/monster/mage.qc @@ -38,33 +38,70 @@ void() mage_heal; void() mage_shield; void() mage_shield_die; +float friend_needshelp(entity e) +{ + if(e == world) + return FALSE; + if(e.health <= 0) + return FALSE; + if(vlen(e.origin - self.origin) > autocvar_g_monster_mage_heal_range) + return FALSE; + if(IsDifferentTeam(e, self)) + return FALSE; + if(e.frozen) + return FALSE; + if(!IS_PLAYER(e)) + return (e.health < e.max_health); + + switch(self.skin) + { + case 0: + { + if(e.health < autocvar_g_balance_health_regenstable) + return TRUE; + break; + } + case 1: + { + if(e.ammo_cells < g_pickup_cells_max || e.ammo_rockets < g_pickup_rockets_max || e.ammo_nails < g_pickup_nails_max || e.ammo_shells < g_pickup_shells_max) + return TRUE; + break; + } + case 2: + { + if(e.armorvalue < autocvar_g_balance_armor_regenstable) + return TRUE; + break; + } + case 3: + { + if(e.health > 0) + return TRUE; + break; + } + } + + return FALSE; +} + void mage_think() { entity head; - float friend_needshelp = FALSE, need_hpammo = FALSE; + float need_help = FALSE; FOR_EACH_PLAYER(head) + if(friend_needshelp(head)) { - need_hpammo = ((g_minstagib) ? head.ammo_cells < start_ammo_cells : head.health < autocvar_g_balance_health_regenstable); - if not(IsDifferentTeam(head, self)) - if(head.health > 0) - if(vlen(head.origin - self.origin) < autocvar_g_monster_mage_heal_range) - if(need_hpammo) - { - friend_needshelp = TRUE; - break; // found 1 player near us who is low on health - } + need_help = TRUE; + break; // found 1 player near us who is low on health } - FOR_EACH_MONSTER(head) if(head != self) + if(!need_help) + FOR_EACH_MONSTER(head) + if(head != self) + if(friend_needshelp(head)) { - if not(IsDifferentTeam(head, self)) - if(head.health > 0) - if(vlen(head.origin - self.origin) < autocvar_g_monster_mage_heal_range) - if(head.health < head.max_health) - { - friend_needshelp = TRUE; - break; // found 1 player near us who is low on health - } + need_help = TRUE; + break; // found 1 player near us who is low on health } self.think = mage_think; @@ -74,7 +111,7 @@ void mage_think() if(time >= self.weaponentity.ltime) mage_shield_die(); - if(self.health < autocvar_g_monster_mage_heal_minhealth || friend_needshelp) + if(self.health < autocvar_g_monster_mage_heal_minhealth || need_help) if(time >= self.attack_finished_single) if(random() < 0.5) mage_heal(); @@ -216,38 +253,55 @@ void mage_spike() void mage_heal() { entity head; - if(self.health < self.max_health) // only show our effect if we are healing ourself too - pointparticles(particleeffectnum("healing_fx"), self.origin, '0 0 0', 1); - self.health = bound(0, self.health + autocvar_g_monster_mage_heal_self, self.max_health); - WaypointSprite_UpdateHealth(self.sprite, self.health); - monsters_setframe(mage_anim_attack); - self.attack_finished_single = time + autocvar_g_monster_mage_heal_delay; + float washealed = FALSE; - for(head = world; (head = findfloat(head, monster_attack, TRUE)); ) + for(head = world; (head = findfloat(head, monster_attack, TRUE)); ) if(friend_needshelp(head)) { - if(head.health > 0) - if not(head.frozen) - if(vlen(head.origin - self.origin) < autocvar_g_monster_mage_heal_range) - if not(IsDifferentTeam(head, self)) + washealed = TRUE; + string fx = ""; + if(IS_PLAYER(head)) { - if(IS_PLAYER(head)) + switch(self.skin) { - if((g_minstagib && head.ammo_cells < start_ammo_cells) || head.health < start_health) - pointparticles(particleeffectnum(((g_minstagib) ? "ammoregen_fx" : "healing_fx")), head.origin, '0 0 0', 1); - if(g_minstagib) - head.ammo_cells = bound(0, head.ammo_cells + 1, start_ammo_cells); - else - head.health = bound(0, head.health + autocvar_g_monster_mage_heal_friends, g_pickup_healthmedium_max); - } - else - { - if(head.health < head.max_health) - pointparticles(particleeffectnum("healing_fx"), head.origin, '0 0 0', 1); - head.health = bound(0, head.health + autocvar_g_monster_mage_heal_friends, head.max_health); - WaypointSprite_UpdateHealth(head.sprite, head.health); + case 0: + if(head.health < autocvar_g_balance_health_regenstable) head.health = bound(0, head.health + autocvar_g_monster_mage_heal_friends, 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_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); + fx = "ammoregen_fx"; + break; + case 2: + if(head.armorvalue < autocvar_g_balance_armor_regenstable) + { + head.armorvalue = bound(0, head.armorvalue + autocvar_g_monster_mage_heal_friends, autocvar_g_balance_armor_regenstable); + fx = "armorrepair_fx"; + } + break; + case 3: + head.health = bound(0, head.health - ((head == self) ? autocvar_g_monster_mage_heal_self : autocvar_g_monster_mage_heal_friends), 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 + autocvar_g_monster_mage_heal_friends, head.max_health); + WaypointSprite_UpdateHealth(head.sprite, head.health); } } + + if(washealed) + { + monsters_setframe(mage_anim_attack); + self.attack_finished_single = time + autocvar_g_monster_mage_heal_delay; + } } void mage_shield_die() diff --git a/qcsrc/server/mutators/mutator_minstagib.qc b/qcsrc/server/mutators/mutator_minstagib.qc index 8aa8c83bd..d6001d728 100644 --- a/qcsrc/server/mutators/mutator_minstagib.qc +++ b/qcsrc/server/mutators/mutator_minstagib.qc @@ -116,6 +116,15 @@ MUTATOR_HOOKFUNCTION(minstagib_MonsterLoot) return FALSE; } +MUTATOR_HOOKFUNCTION(minstagib_MonsterSpawn) +{ + // always refill ammo + if(self.monsterid == MONSTER_MAGE) + self.skin = 1; + + return FALSE; +} + MUTATOR_HOOKFUNCTION(minstagib_BotShouldAttack) { if(checkentity.items & IT_STRENGTH) @@ -414,6 +423,7 @@ MUTATOR_DEFINITION(mutator_minstagib) { MUTATOR_HOOK(MatchEnd, minstagib_MatchEnd, CBC_ORDER_ANY); MUTATOR_HOOK(MonsterDropItem, minstagib_MonsterLoot, CBC_ORDER_ANY); + MUTATOR_HOOK(MonsterSpawn, minstagib_MonsterSpawn, CBC_ORDER_ANY); MUTATOR_HOOK(BotShouldAttack, minstagib_BotShouldAttack, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerPhysics, minstagib_PlayerPhysics, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerSpawn, minstagib_PlayerSpawn, CBC_ORDER_ANY);