]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Attempt to improve monster skill based damage calculation
authorMario <mario.mario@y7mail.com>
Sat, 12 Oct 2013 19:24:48 +0000 (06:24 +1100)
committerMario <mario.mario@y7mail.com>
Sat, 12 Oct 2013 19:24:48 +0000 (06:24 +1100)
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/spawn.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/monsters/sv_monsters.qh
qcsrc/common/notifications.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_invasion.qc
qcsrc/server/mutators/gamemode_invasion.qh

index d7b9cef7cd4c9d65579c7a7eebe65b7abd1be4dd..0ea8924b6a41f43d33082a080565965f93a96864 100644 (file)
@@ -67,7 +67,7 @@ void CastLightning()
 
        traceline (org, self.origin + dir * 1000, TRUE, self);
                
-       FireRailgunBullet (org, org + dir * 1000, MON_CVAR(shambler, attack_lightning_damage) * monster_skill, 0, 0, 0, 0, 0, DEATH_MONSTER_SHAMBLER_ZAP);
+       FireRailgunBullet (org, org + dir * 1000, MON_CVAR(shambler, attack_lightning_damage) * Monster_SkillModifier(), 0, 0, 0, 0, 0, DEATH_MONSTER_SHAMBLER_ZAP);
        
        // teamcolor / hit beam effect
        //v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
index 7d381531872f1429389a7888de676eade503682c..ab35a63b8ec63fa86e9f140639114a6bc3c435cb 100644 (file)
@@ -66,7 +66,7 @@ void spider_web_explode()
                                        Freeze(e, 0.3, 2, FALSE);
                                        break;
                                case SPIDER_TYPE_FIRE:
-                                       Fire_AddDamage(e, self.realowner, 5 * monster_skill, MON_CVAR(spider, attack_web_damagetime), DEATH_MONSTER_SPIDER_FIRE);
+                                       Fire_AddDamage(e, self.realowner, 5 * Monster_SkillModifier(), MON_CVAR(spider, attack_web_damagetime), DEATH_MONSTER_SPIDER_FIRE);
                                        break;
                        }
                }
index c59c63b376affdbf069a6e319e1a1c24f393ea44..162331a11723a7459dc2d316acd15bf2205c6dea 100644 (file)
@@ -42,7 +42,7 @@ void wyvern_fireball_explode()
                RadiusDamage(self, self.realowner, MON_CVAR(wyvern, attack_fireball_damage), MON_CVAR(wyvern, attack_fireball_edgedamage), MON_CVAR(wyvern, attack_fireball_force), world, MON_CVAR(wyvern, attack_fireball_radius), self.projectiledeathtype, world);
                
                for(e = world; (e = findfloat(e, takedamage, DAMAGE_AIM)); ) if(vlen(e.origin - self.origin) <= MON_CVAR(wyvern, attack_fireball_radius))
-                       Fire_AddDamage(e, self, 5 * monster_skill, MON_CVAR(wyvern, attack_fireball_damagetime), self.projectiledeathtype);
+                       Fire_AddDamage(e, self, 5 * Monster_SkillModifier(), MON_CVAR(wyvern, attack_fireball_damagetime), self.projectiledeathtype);
                
                remove(self);
        }
index 307737ff81d0a9e05155465af2eb3ba855f7bbd7..8670e8454afe8bb49f105a11288f0ac7a2945a58 100644 (file)
@@ -69,7 +69,7 @@ void zombie_attack_leap_touch()
        {
                angles_face = vectoangles(self.moveto - self.origin);
                angles_face = normalize(angles_face) * MON_CVAR(zombie, attack_leap_force);
-               Damage(other, self, self, MON_CVAR(zombie, attack_leap_damage) * monster_skill, DEATH_MONSTER_ZOMBIE_JUMP, other.origin, angles_face);
+               Damage(other, self, self, MON_CVAR(zombie, attack_leap_damage) * Monster_SkillModifier(), DEATH_MONSTER_ZOMBIE_JUMP, other.origin, angles_face);
                self.touch = MonsterTouch; // instantly turn it off to stop damage spam
        }
 
index ebe8ba8e085349db82a39094816cff9130480b95..bd2a216bc985b0e71b3275ac38e24b1037c32afb 100644 (file)
@@ -37,11 +37,6 @@ entity spawnmonster (string monster, float monster_id, entity spawnedby, entity
        
        if(moveflag)
                e.monster_moveflags = moveflag;
-               
-       if(e.team || !IS_PLAYER(spawnedby))
-               e.colormap = 1024;
-       else
-               e.colormap = spawnedby.colormap;
        
        if(IS_PLAYER(spawnedby))
        {
index 5136bbbf8d5dd038990f64d9f91a8e2b09210b12..b46675617be1bcb158ea1f85f57ace5d25219d9c 100644 (file)
@@ -41,6 +41,15 @@ void monster_dropitem()
        }
 }
 
+float Monster_SkillModifier()
+{
+       float t = 1;
+       
+       t *= (self.monster_skill * 0.5);
+       
+       return t;
+}
+
 float monster_isvalidtarget (entity targ, entity ent)
 {
        if(!targ || !ent)
@@ -292,8 +301,6 @@ void monster_makevectors(entity e)
 
 float monster_melee(entity targ, float damg, float anim, float er, float anim_finished, float deathtype, float dostop)
 {
-       float rdmg = damg * random();
-
        if (self.health <= 0)
                return FALSE; // attacking while dead?!
 
@@ -314,7 +321,7 @@ float monster_melee(entity targ, float damg, float anim, float er, float anim_fi
        traceline(self.origin + self.view_ofs, self.origin + v_forward * er, 0, self);
 
        if(trace_ent.takedamage)
-               Damage(trace_ent, self, self, rdmg * monster_skill, deathtype, trace_ent.origin, normalize(trace_ent.origin - self.origin));
+               Damage(trace_ent, self, self, damg * Monster_SkillModifier(), deathtype, trace_ent.origin, normalize(trace_ent.origin - self.origin));
 
        return TRUE;
 }
@@ -971,6 +978,23 @@ void monster_spawn()
        self.nextthink = time + self.ticrate;
 
        MUTATOR_CALLHOOK(MonsterSpawn);
+       
+       // TODO: fix this mess
+       if(IS_PLAYER(self.monster_owner))
+               self.colormap = self.monster_owner.colormap;
+       else if(teamplay && self.team)
+               self.colormap = 1024 + self.team * 17;
+       else
+       {
+               if(self.monster_skill <= MONSTER_SKILL_EASY)
+                       self.colormap = 1027;
+               else if(self.monster_skill <= MONSTER_SKILL_MEDIUM)
+                       self.colormap = 1038;
+               else if(self.monster_skill <= MONSTER_SKILL_HARD)
+                       self.colormap = 1028;
+               else
+                       self.colormap = 1024;
+       }
 }
 
 float monster_initialize(float mon_id, float nodrop)
@@ -979,11 +1003,14 @@ float monster_initialize(float mon_id, float nodrop)
                return FALSE;
 
        entity mon = get_monsterinfo(mon_id);
+       
+       if not(self.monster_skill)
+               self.monster_skill = cvar("g_monsters_skill");
 
        // support for quake style removing monsters based on skill
-       if(monster_skill <= 1) if(self.spawnflags & MONSTERSKILL_NOTEASY) { return FALSE; }
-       if(monster_skill == 2) if(self.spawnflags & MONSTERSKILL_NOTMEDIUM) { return FALSE; }
-       if(monster_skill >= 3) if(self.spawnflags & MONSTERSKILL_NOTHARD) { return FALSE; }
+       if(self.monster_skill == MONSTER_SKILL_EASY) if(self.spawnflags & MONSTERSKILL_NOTEASY) { return FALSE; }
+       if(self.monster_skill == MONSTER_SKILL_MEDIUM) if(self.spawnflags & MONSTERSKILL_NOTMEDIUM) { return FALSE; }
+       if(self.monster_skill == MONSTER_SKILL_HARD) if(self.spawnflags & MONSTERSKILL_NOTHARD) { return FALSE; }
 
        if(self.team && !teamplay)
                self.team = 0;
index 851dacd745c77fa208d59c062a1e51fc98fc4ca9..3ac6c87d326a56aba27046151d6e03cabf157be4 100644 (file)
@@ -1,8 +1,6 @@
 .string spawnmob;
 .float monster_attack;
 
-float monster_skill;
-
 .entity monster_owner; // new monster owner entity, fixes non-solid monsters
 .float monstercount; // per player monster count
 
@@ -16,8 +14,15 @@ void monsters_setstatus(); // monsters.qc
 void monster_remove(entity mon); // removes a monster
 
 .float(float attack_type) monster_attackfunc;
-const float MONSTER_ATTACK_MELEE       = 1;
-const float MONSTER_ATTACK_RANGED      = 2;
+const float MONSTER_ATTACK_MELEE = 1;
+const float MONSTER_ATTACK_RANGED = 2;
+
+.float monster_skill;
+const float MONSTER_SKILL_EASY = 1;
+const float MONSTER_SKILL_MEDIUM = 3;
+const float MONSTER_SKILL_HARD = 5;
+const float MONSTER_SKILL_INSANE = 7;
+const float MONSTER_SKILL_NIGHTMARE = 10;
 
 .float fish_wasdrowning; // used to reset a drowning fish's angles if it reaches water again
 
index 5be81faf6d5799ab775b4a433735e917bfe995d6..7bf58ac95ef7a0c926f98f68155dfe762bc596c3 100644 (file)
@@ -625,6 +625,7 @@ void Send_Notification_WOCOVA(
        MSG_CENTER_NOTIF(1, CENTER_ROUND_PLAYER_WIN,            1, 0, "s1",           CPID_ROUND,          "0 0", _("^BG%s^BG wins the round"), "") \
        MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_SELF,              0, 0, "",             NO_CPID,             "0 0", _("^K1You froze yourself"), "") \
        MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_SPAWN_LATE,        0, 0, "",             NO_CPID,             "0 0", _("^K1Round already started, you spawn as frozen"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_INVASION_SUPERMONSTER,       1, 0, "s1",           NO_CPID,             "0 0", _("^K1A %s has arrived!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_DONTHAVE,        0, 1, "item_wepname",                      CPID_ITEM, "item_centime 0", _("^BGYou do not have the ^F1%s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_DROP,            1, 1, "item_wepname item_wepammo",         CPID_ITEM, "item_centime 0", _("^BGYou dropped the ^F1%s^BG%s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_GOT,             0, 1, "item_wepname",                      CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1%s"), "") \
index dec1502da1b92984dacfbb4552fa9e642e4e7c10..941837118766e880b16b57bf0d3546718106f6e3 100644 (file)
@@ -948,8 +948,6 @@ void readlevelcvars(void)
     g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
     g_bugrigs_steer = cvar("g_bugrigs_steer");
        
-       monster_skill = cvar("g_monsters_skill");
-       
        g_minstagib = cvar("g_minstagib");
 
        sv_clones = cvar("sv_clones");
index 1f55f776ad43c3010cb424dda0fe9f87b897a29e..560f05b9884000e8981d6e73e63b92fbb9f0dc95 100644 (file)
@@ -166,6 +166,8 @@ void Invasion_RoundStart()
                
        roundcnt += 1;
        
+       invasion_monsterskill = roundcnt + max(1, numplayers * 0.3);
+       
        maxcurrent = 0;
        numspawned = 0;
        numkilled = 0;
@@ -174,8 +176,6 @@ void Invasion_RoundStart()
                maxspawned = rint(autocvar_g_invasion_monster_count * (roundcnt * 0.5));
        else
                maxspawned = autocvar_g_invasion_monster_count;
-       
-       monster_skill += 0.1 * numplayers;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_MonsterDies)
@@ -209,6 +209,11 @@ MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn)
                maxcurrent += 1;
        }
        
+       self.monster_skill = invasion_monsterskill;
+       
+       if((get_monsterinfo(self.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER)
+               Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, M_NAME(self.monsterid));
+       
        self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
        
        return FALSE;
@@ -252,7 +257,7 @@ MUTATOR_HOOKFUNCTION(invasion_PlayerCommand)
                sprint(self, strcat("roundcnt = ", ftos(roundcnt), "\n"));
                sprint(self, strcat("monsters_total = ", ftos(monsters_total), "\n"));
                sprint(self, strcat("monsters_killed = ", ftos(monsters_killed), "\n"));
-               sprint(self, strcat("monster_skill = ", ftos(monster_skill), "\n"));
+               sprint(self, strcat("invasion_monsterskill = ", ftos(invasion_monsterskill), "\n"));
                
                return TRUE;
        }
@@ -288,8 +293,6 @@ void invasion_Initialize()
        
        allowed_to_spawn = TRUE;
        
-       monster_skill = 0.5;
-       
        roundcnt = 0;
 }
 
index 3d10814b49f8bbddb13e235476955ec42cd3f9e1..41ccfb3c74abd3407224e70fff44c4b763547725 100644 (file)
@@ -5,3 +5,5 @@ float maxrounds;
 float numkilled;
 float last_check;
 float maxcurrent;
+
+float invasion_monsterskill;