From 65b716f5863db1a3f27fc366a6f80c8afb195c23 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Thu, 23 Jun 2016 00:41:21 +0200 Subject: [PATCH] Removed some hardcoded mob ids Created some race2 values for mobs used in the Manuk and Splendide status changes --- db/import-tmpl/mob_race2_db.txt | 2 +- db/re/mob_race2_db.txt | 6 ++++- src/map/battle.c | 46 +++++++++------------------------ src/map/map.h | 2 ++ src/map/mob.c | 4 --- src/map/mob.h | 13 ---------- src/map/script_constants.h | 3 +++ 7 files changed, 23 insertions(+), 53 deletions(-) diff --git a/db/import-tmpl/mob_race2_db.txt b/db/import-tmpl/mob_race2_db.txt index 2f18294033..347e61eba2 100644 --- a/db/import-tmpl/mob_race2_db.txt +++ b/db/import-tmpl/mob_race2_db.txt @@ -1,5 +1,5 @@ // Monster Racial Groups Database // // Structure of Database: -// Race2ID,MobID1,MobID2,MobID3,...,MobID9 +// Race2ID,MobID1,MobID2,MobID3,...,MobID100 diff --git a/db/re/mob_race2_db.txt b/db/re/mob_race2_db.txt index 6829cc8c97..728d5ddff1 100644 --- a/db/re/mob_race2_db.txt +++ b/db/re/mob_race2_db.txt @@ -1,7 +1,7 @@ // Monster Racial Groups Database // // Structure of Database: -// Race2ID,MobID1,MobID2,MobID3,...,MobID50 +// Race2ID,MobID1,MobID2,MobID3,...,MobID100 // Goblins 1,1122,1123,1124,1125,1126,1258,1299 @@ -24,3 +24,7 @@ // Bio Labs // TODO : Monsters in lhz_dun_n not implemented yet. [secretdataz] 10,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241 +// Manuk +11,1986,1987,1988,1989,1990,1997,1998,1999 +// Splendide +12,1991,1992,1993,1994,1995 diff --git a/src/map/battle.c b/src/map/battle.c index 00da84a6b2..f1be96473c 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1306,23 +1306,11 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam // Compressed code, fixed by map.h [Epoque] if (src->type == BL_MOB) { - int i; - - if (sc->data[SC_MANU_DEF]) { - for (i=0;ARRAYLENGTH(mob_manuk)>i;i++) { - if (mob_manuk[i]==((TBL_MOB*)src)->mob_id) { - damage -= damage * sc->data[SC_MANU_DEF]->val1 / 100; - break; - } - } + if( sc->data[SC_MANU_DEF] && status_get_race2(src) == RC2_MANUK ){ + damage -= damage * sc->data[SC_MANU_DEF]->val1 / 100; } - if (sc->data[SC_SPL_DEF]) { - for (i=0;ARRAYLENGTH(mob_splendide)>i;i++) { - if (mob_splendide[i]==((TBL_MOB*)src)->mob_id) { - damage -= damage * sc->data[SC_SPL_DEF]->val1 / 100; - break; - } - } + if( sc->data[SC_SPL_DEF] && status_get_race2(src) == RC2_SPLENDIDE ){ + damage -= damage * sc->data[SC_SPL_DEF]->val1 / 100; } } @@ -1462,27 +1450,17 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam // [Epoque] if (bl->type == BL_MOB) { - uint8 i; - - if ( ((sce=sc->data[SC_MANU_ATK]) && (flag&BF_WEAPON)) || - ((sce=sc->data[SC_MANU_MATK]) && (flag&BF_MAGIC)) + if ( (((sce=sc->data[SC_MANU_ATK]) && (flag&BF_WEAPON)) || + ((sce=sc->data[SC_MANU_MATK]) && (flag&BF_MAGIC))) && + status_get_race2(bl) == RC2_MANUK ) { - for (i=0;ARRAYLENGTH(mob_manuk)>i;i++) { - if (((TBL_MOB*)bl)->mob_id==mob_manuk[i]) { - damage += damage * sce->val1 / 100; - break; - } - } + damage += damage * sce->val1 / 100; } - if ( ((sce=sc->data[SC_SPL_ATK]) && (flag&BF_WEAPON)) || - ((sce=sc->data[SC_SPL_MATK]) && (flag&BF_MAGIC)) + if ( (((sce=sc->data[SC_SPL_ATK]) && (flag&BF_WEAPON)) || + ((sce=sc->data[SC_SPL_MATK]) && (flag&BF_MAGIC))) && + status_get_race2(bl) == RC2_SPLENDIDE ) { - for (i=0;ARRAYLENGTH(mob_splendide)>i;i++) { - if (((TBL_MOB*)bl)->mob_id==mob_splendide[i]) { - damage += damage * sce->val1 / 100; - break; - } - } + damage += damage * sce->val1 / 100; } } /* Self Buff that destroys the armor of any target hit with melee or ranged physical attacks */ diff --git a/src/map/map.h b/src/map/map.h index 8f9cc830a0..65ee5349f7 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -297,6 +297,8 @@ enum e_race2 { RC2_BATTLEFIELD, RC2_TREASURE, RC2_BIOLAB, + RC2_MANUK, + RC2_SPLENDIDE, RC2_MAX }; diff --git a/src/map/mob.c b/src/map/mob.c index 93d207a4c7..bc47e4c62f 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -104,10 +104,6 @@ struct s_randomsummon_group { static DBMap *mob_summon_db; /// Random Summon DB. struct s_randomsummon_group -> group_id -//Defines the Manuk/Splendide mob groups for the status reductions [Epoque] -const int mob_manuk[8] = { MOBID_TATACHO, MOBID_CENTIPEDE, MOBID_NEPENTHES, MOBID_HILLSRION, MOBID_HARDROCK_MOMMOTH, MOBID_G_TATACHO, MOBID_G_HILLSRION, MOBID_CENTIPEDE_LARVA }; -const int mob_splendide[5] = { MOBID_TENDRILRION, MOBID_CORNUS, MOBID_NAGA, MOBID_LUCIOLA_VESPA, MOBID_PINGUICULA }; - /*========================================== * Local prototype declaration (only required thing) *------------------------------------------*/ diff --git a/src/map/mob.h b/src/map/mob.h index b3c15c9d4b..85b642165e 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -61,19 +61,6 @@ enum MOBID { MOBID_G_GEOGRAPHER = 1590, MOBID_GUARDIAN_STONE1 = 1907, MOBID_GUARDIAN_STONE2, - MOBID_TATACHO = 1986, - MOBID_CENTIPEDE, - MOBID_NEPENTHES, - MOBID_HILLSRION, - MOBID_HARDROCK_MOMMOTH, - MOBID_TENDRILRION, - MOBID_CORNUS, - MOBID_NAGA, - MOBID_LUCIOLA_VESPA, - MOBID_PINGUICULA, - MOBID_G_TATACHO = 1997, - MOBID_G_HILLSRION, - MOBID_CENTIPEDE_LARVA, MOBID_SILVERSNIPER = 2042, MOBID_MAGICDECOY_FIRE, MOBID_MAGICDECOY_WATER, diff --git a/src/map/script_constants.h b/src/map/script_constants.h index 62c99dd512..df587654ec 100644 --- a/src/map/script_constants.h +++ b/src/map/script_constants.h @@ -2424,6 +2424,9 @@ export_constant(RC2_BATTLEFIELD); export_constant(RC2_TREASURE); export_constant(RC2_BIOLAB); + export_constant(RC2_MANUK); + export_constant(RC2_SPLENDIDE); + export_constant(RC2_MAX); /* classes */ export_constant(CLASS_NORMAL);