X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fmage.qc;h=bdbae245f5c2c205a27f9615fc6c094a86810d55;hb=5d929ee0b1dc587e3154a4fa4b56e83b9ba9100b;hp=bd2c7c940680e4d2e70e57e22fba7beb25a3f4ff;hpb=3fc2359b7933352424af07db8f84cbb9342e934f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index bd2c7c940..bdbae245f 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -87,31 +87,31 @@ bool M_Mage_Defend_Heal_Check(entity this, entity targ) { if(targ == NULL) return false; - if(GetResourceAmount(targ, RES_HEALTH) <= 0) + if(GetResource(targ, RES_HEALTH) <= 0) return false; if(DIFF_TEAM(targ, this) && targ != this.monster_follow) return false; if(STAT(FROZEN, targ)) return false; if(!IS_PLAYER(targ)) - return (IS_MONSTER(targ) && GetResourceAmount(targ, RES_HEALTH) < targ.max_health); + return (IS_MONSTER(targ) && GetResource(targ, RES_HEALTH) < targ.max_health); if(targ.items & ITEM_Shield.m_itemid) return false; switch(this.skin) { - case 0: return (GetResourceAmount(targ, RES_HEALTH) < autocvar_g_balance_health_regenstable); + case 0: return (GetResource(targ, RES_HEALTH) < autocvar_g_balance_health_regenstable); case 1: { - return ((GetResourceAmount(targ, RES_CELLS) && GetResourceAmount(targ, RES_CELLS) < g_pickup_cells_max) - || (GetResourceAmount(targ, RES_PLASMA) && GetResourceAmount(targ, RES_PLASMA) < g_pickup_plasma_max) - || (GetResourceAmount(targ, RES_ROCKETS) && GetResourceAmount(targ, RES_ROCKETS) < g_pickup_rockets_max) - || (GetResourceAmount(targ, RES_BULLETS) && GetResourceAmount(targ, RES_BULLETS) < g_pickup_nails_max) - || (GetResourceAmount(targ, RES_SHELLS) && GetResourceAmount(targ, RES_SHELLS) < g_pickup_shells_max) + return ((GetResource(targ, RES_CELLS) && GetResource(targ, RES_CELLS) < g_pickup_cells_max) + || (GetResource(targ, RES_PLASMA) && GetResource(targ, RES_PLASMA) < g_pickup_plasma_max) + || (GetResource(targ, RES_ROCKETS) && GetResource(targ, RES_ROCKETS) < g_pickup_rockets_max) + || (GetResource(targ, RES_BULLETS) && GetResource(targ, RES_BULLETS) < g_pickup_nails_max) + || (GetResource(targ, RES_SHELLS) && GetResource(targ, RES_SHELLS) < g_pickup_shells_max) ); } - case 2: return (GetResourceAmount(targ, RES_ARMOR) < autocvar_g_balance_armor_regenstable); - case 3: return (GetResourceAmount(targ, RES_HEALTH) > 0); + case 2: return (GetResource(targ, RES_ARMOR) < autocvar_g_balance_armor_regenstable); + case 3: return (GetResource(targ, RES_HEALTH) > 0); } return false; @@ -144,7 +144,7 @@ void M_Mage_Attack_Spike_Touch(entity this, entity toucher) // copied from W_Seeker_Think void M_Mage_Attack_Spike_Think(entity this) { - if (time > this.ltime || (this.enemy && GetResourceAmount(this.enemy, RES_HEALTH) <= 0) || GetResourceAmount(this.owner, RES_HEALTH) <= 0) { + if (time > this.ltime || (this.enemy && GetResource(this.enemy, RES_HEALTH) <= 0) || GetResource(this.owner, RES_HEALTH) <= 0) { this.projectiledeathtype |= HITTYPE_SPLASH; M_Mage_Attack_Spike_Explode(this, NULL); } @@ -241,17 +241,17 @@ void M_Mage_Defend_Heal(entity this) } case 1: { - if(GetResourceAmount(this, RES_CELLS)) GiveResourceWithLimit(it, RES_CELLS, 1, g_pickup_cells_max); - if(GetResourceAmount(this, RES_PLASMA)) GiveResourceWithLimit(it, RES_PLASMA, 1, g_pickup_plasma_max); - if(GetResourceAmount(this, RES_ROCKETS)) GiveResourceWithLimit(it, RES_ROCKETS, 1, g_pickup_rockets_max); - if(GetResourceAmount(this, RES_SHELLS)) GiveResourceWithLimit(it, RES_SHELLS, 2, g_pickup_shells_max); - if(GetResourceAmount(this, RES_BULLETS)) GiveResourceWithLimit(it, RES_BULLETS, 5, g_pickup_nails_max); + if(GetResource(this, RES_CELLS)) GiveResourceWithLimit(it, RES_CELLS, 1, g_pickup_cells_max); + if(GetResource(this, RES_PLASMA)) GiveResourceWithLimit(it, RES_PLASMA, 1, g_pickup_plasma_max); + if(GetResource(this, RES_ROCKETS)) GiveResourceWithLimit(it, RES_ROCKETS, 1, g_pickup_rockets_max); + if(GetResource(this, RES_SHELLS)) GiveResourceWithLimit(it, RES_SHELLS, 2, g_pickup_shells_max); + if(GetResource(this, RES_BULLETS)) GiveResourceWithLimit(it, RES_BULLETS, 5, g_pickup_nails_max); // TODO: fuel? fx = EFFECT_AMMO_REGEN; break; } case 2: - if(GetResourceAmount(it, RES_ARMOR) < autocvar_g_balance_armor_regenstable) + if(GetResource(it, RES_ARMOR) < autocvar_g_balance_armor_regenstable) { GiveResourceWithLimit(it, RES_ARMOR, autocvar_g_monster_mage_heal_allies, autocvar_g_balance_armor_regenstable); fx = EFFECT_ARMOR_REPAIR; @@ -271,7 +271,7 @@ void M_Mage_Defend_Heal(entity this) Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1); Heal(it, this, autocvar_g_monster_mage_heal_allies, RES_LIMIT_NONE); if(!(it.spawnflags & MONSTERFLAG_INVINCIBLE) && it.sprite) - WaypointSprite_UpdateHealth(it.sprite, GetResourceAmount(it, RES_HEALTH)); + WaypointSprite_UpdateHealth(it.sprite, GetResource(it, RES_HEALTH)); } }); @@ -325,14 +325,14 @@ void M_Mage_Attack_Teleport(entity this, entity targ) void M_Mage_Defend_Shield_Remove(entity this) { this.effects &= ~(EF_ADDITIVE | EF_BLUE); - SetResourceAmount(this, RES_ARMOR, autocvar_g_monsters_armor_blockpercent); + SetResource(this, RES_ARMOR, autocvar_g_monsters_armor_blockpercent); } void M_Mage_Defend_Shield(entity this) { this.effects |= (EF_ADDITIVE | EF_BLUE); this.mage_shield_delay = time + (autocvar_g_monster_mage_shield_delay); - SetResourceAmount(this, RES_ARMOR, autocvar_g_monster_mage_shield_blockpercent); + SetResource(this, RES_ARMOR, autocvar_g_monster_mage_shield_blockpercent); this.mage_shield_time = time + (autocvar_g_monster_mage_shield_time); setanim(this, this.anim_shoot, true, true, true); this.attack_finished_single[0] = time + 1; @@ -419,16 +419,16 @@ METHOD(Mage, mr_think, bool(Mage thismon, entity actor)) }); } - if(GetResourceAmount(actor, RES_HEALTH) < (autocvar_g_monster_mage_heal_minhealth) || need_help) + if(GetResource(actor, RES_HEALTH) < (autocvar_g_monster_mage_heal_minhealth) || need_help) if(time >= actor.attack_finished_single[0]) if(random() < 0.5) M_Mage_Defend_Heal(actor); - if(time >= actor.mage_shield_time && GetResourceAmount(actor, RES_ARMOR)) + if(time >= actor.mage_shield_time && GetResource(actor, RES_ARMOR)) M_Mage_Defend_Shield_Remove(actor); if(actor.enemy) - if(GetResourceAmount(actor, RES_HEALTH) < actor.max_health) + if(GetResource(actor, RES_HEALTH) < actor.max_health) if(time >= actor.mage_shield_delay) if(random() < 0.5) M_Mage_Defend_Shield(actor); @@ -469,7 +469,7 @@ METHOD(Mage, mr_anim, bool(Mage this, entity actor)) METHOD(Mage, mr_setup, bool(Mage this, entity actor)) { TC(Mage, this); - if(!GetResourceAmount(this, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_mage_health); + if(!GetResource(this, RES_HEALTH)) SetResource(actor, RES_HEALTH, autocvar_g_monster_mage_health); if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); } if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); } if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_mage_speed_stop); }