summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.cpp4
-rw-r--r--src/map/battle.cpp2
-rw-r--r--src/map/mob.cpp9
-rw-r--r--src/map/mob.hpp4
-rw-r--r--src/map/script-fun.cpp29
-rw-r--r--src/map/script-fun.t.hpp93
6 files changed, 94 insertions, 47 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index f5ca72d..d7d47c9 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -1852,7 +1852,7 @@ ATCE atcommand_mobinfo(Session *s, dumb_ptr<map_session_data> sd,
clif_displaymessage(s, STRPRINTF("Monster ID: %i, English Name: %s, Japanese Name: %s"_fmt, mob_id, get_mob_db(mob_id).name, get_mob_db(mob_id).jname));
clif_displaymessage(s, STRPRINTF("Level: %i, HP: %i, SP: %i, Base EXP: %i, JEXP: %i"_fmt, get_mob_db(mob_id).lv, get_mob_db(mob_id).max_hp, get_mob_db(mob_id).max_sp, get_mob_db(mob_id).base_exp, get_mob_db(mob_id).job_exp));
- clif_displaymessage(s, STRPRINTF("Range1: %i, ATK1: %i, ATK2: %i, DEF: %i, MDEF: %i"_fmt, get_mob_db(mob_id).range, get_mob_db(mob_id).atk1, get_mob_db(mob_id).atk2, get_mob_db(mob_id).def, get_mob_db(mob_id).mdef));
+ clif_displaymessage(s, STRPRINTF("Range1: %i, ATK1: %i, ATK2: %i, DEF: %i, MDEF: %i, CRITICAL_DEF: %i"_fmt, get_mob_db(mob_id).range, get_mob_db(mob_id).atk1, get_mob_db(mob_id).atk2, get_mob_db(mob_id).def, get_mob_db(mob_id).mdef, get_mob_db(mob_id).critical_def));
clif_displaymessage(s, STRPRINTF("Stats: STR: %i, AGI: %i, VIT: %i, INT: %i, DEX:, %i LUK:, %i"_fmt, get_mob_db(mob_id).attrs[ATTR::STR], get_mob_db(mob_id).attrs[ATTR::AGI], get_mob_db(mob_id).attrs[ATTR::VIT], get_mob_db(mob_id).attrs[ATTR::INT], get_mob_db(mob_id).attrs[ATTR::DEX], get_mob_db(mob_id).attrs[ATTR::LUK]));
clif_displaymessage(s, STRPRINTF("Range2: %i, Range3: %i, Scale: %i, Race: %i, Element: %i, Element Level: %i, Mode: %i"_fmt, get_mob_db(mob_id).range2, get_mob_db(mob_id).range3, get_mob_db(mob_id).size, get_mob_db(mob_id).race, get_mob_db(mob_id).element.element, get_mob_db(mob_id).element.level, get_mob_db(mob_id).mode));
clif_displaymessage(s, STRPRINTF("Speed: %i, Adelay: %i, Amotion: %i, Dmotion: %i"_fmt, get_mob_db(mob_id).speed.count(), get_mob_db(mob_id).adelay.count(), get_mob_db(mob_id).amotion.count(), get_mob_db(mob_id).dmotion.count()));
@@ -1922,7 +1922,7 @@ ATCE atcommand_mobinfo(Session *s, dumb_ptr<map_session_data> sd,
str[strpos] = '\0';
int drop_rate2 = 10000/drop_rate;
- clif_displaymessage(s, STRPRINTF("Drop ID %i: %i, Item Name: %s, Drop Chance: %s%% (1:%i)"_fmt,i+1, get_mob_db(mob_id).dropitem[i].nameid, item_name, str, drop_rate2));
+ clif_displaymessage(s, STRPRINTF("Drop ID %i: %i, Item Name: %s, Drop Chance: %s%% (1:%i)"_fmt,i, get_mob_db(mob_id).dropitem[i].nameid, item_name, str, drop_rate2));
}
else
break;
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 52be591..3b7c6b2 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -1592,6 +1592,8 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src,
if (tsd && tsd->critical_def)
cri = cri * (100 - tsd->critical_def) / 100;
+ else if (tmd && tmd->stats[mob_stat::CRITICAL_DEF])
+ cri = cri * (100 - tmd->stats[mob_stat::CRITICAL_DEF]) / 100;
// ダブルアタックが発動していない | Double Attack is not activated
// 判定(スキルの場合は無視) | Judgment (ignored for skills)
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index 0f273a8..715a9cb 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -173,6 +173,7 @@ earray<int, mob_stat, mob_stat::XP_BONUS> mutation_value //=
2, // mob_stat::DEF
2, // mob_stat::MDEF
2, // mob_stat::SPEED
+ 2, // mob_stat::CRITICAL_DEF
}};
// The mutation scale indicates how far `up' we can go, with 256 indicating 100% Note that this may stack with multiple
@@ -194,6 +195,7 @@ earray<int, mob_stat, mob_stat::XP_BONUS> mutation_scale //=
48, // mob_stat::DEF
48, // mob_stat::MDEF
80, // mob_stat::SPEED
+ 128, // mob_stat::CRITICAL_DEF
}};
// The table below indicates the `average' value for each of the statistics, or -1 if there is none.
@@ -220,6 +222,7 @@ earray<int, mob_stat, mob_stat::XP_BONUS> mutation_base //=
-1, // mob_stat::DEF
20, // mob_stat::MDEF
-1, // mob_stat::SPEED
+ -1, // mob_stat::CRITICAL_DEF
}};
/*========================================
@@ -361,6 +364,7 @@ void mob_init(dumb_ptr<mob_data> md)
md->stats[mob_stat::ADELAY] = get_mob_db(mob_class).adelay.count();
md->stats[mob_stat::DEF] = get_mob_db(mob_class).def;
md->stats[mob_stat::MDEF] = get_mob_db(mob_class).mdef;
+ md->stats[mob_stat::CRITICAL_DEF] = get_mob_db(mob_class).critical_def;
md->stats[mob_stat::SPEED] = get_mob_db(mob_class).speed.count();
md->stats[mob_stat::XP_BONUS] = MOB_XP_BONUS_BASE;
@@ -3495,6 +3499,7 @@ bool mob_readdb(ZString filename)
lstripping(&mdbv.atk2),
lstripping(&mdbv.def),
lstripping(&mdbv.mdef),
+ lstripping(&mdbv.critical_def),
lstripping(&mdbv.attrs[ATTR::STR]),
lstripping(&mdbv.attrs[ATTR::AGI]),
lstripping(&mdbv.attrs[ATTR::VIT]),
@@ -3527,6 +3532,10 @@ bool mob_readdb(ZString filename)
lstripping(&mdbv.dropitem[6].p.num),
lstripping(&mdbv.dropitem[7].nameid),
lstripping(&mdbv.dropitem[7].p.num),
+ lstripping(&mdbv.dropitem[8].nameid),
+ lstripping(&mdbv.dropitem[8].p.num),
+ lstripping(&mdbv.dropitem[9].nameid),
+ lstripping(&mdbv.dropitem[9].p.num),
&ignore,
&ignore,
&ignore,
diff --git a/src/map/mob.hpp b/src/map/mob.hpp
index 47da095..3aa7fc5 100644
--- a/src/map/mob.hpp
+++ b/src/map/mob.hpp
@@ -43,7 +43,7 @@ namespace map
#define JAPANESE_NAME stringish<MobName>("--ja--"_s)
#define MOB_THIS_MAP stringish<MapName>("this"_s)
-#define MaxDrops 8
+#define MaxDrops 10
#define MinMobID 1001
#define MaxMobID 2000
@@ -69,7 +69,7 @@ struct mob_db_
int max_hp, max_sp;
int base_exp, job_exp;
int atk1, atk2;
- int def, mdef;
+ int def, mdef, critical_def;
earray<int, ATTR, ATTR::COUNT> attrs;
int range, range2, range3;
// always 1
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index e42dcd2..9ee76a2 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -2700,6 +2700,9 @@ void builtin_mobinfo(ScriptState *st)
case MobInfo::MDEF:
info = get_mob_db(mob_id).mdef;
break;
+ case MobInfo::CRITICAL_DEF:
+ info = get_mob_db(mob_id).critical_def;
+ break;
case MobInfo::STR:
info = get_mob_db(mob_id).attrs[ATTR::STR];
break;
@@ -2757,6 +2760,19 @@ void builtin_mobinfo(ScriptState *st)
case MobInfo::MUTATION_POWER:
info = get_mob_db(mob_id).mutation_power;
break;
+ case MobInfo::DROPID0:
+ info = unwrap<ItemNameId>(get_mob_db(mob_id).dropitem[0].nameid);
+ break;
+ case MobInfo::DROPNAME0:
+ {
+ Option<P<struct item_data>> i_data = Some(itemdb_search(get_mob_db(mob_id).dropitem[0].nameid));
+ info_str = i_data.pmd_pget(&item_data::name).copy_or(stringish<ItemName>(""_s));
+ mode = 1;
+ }
+ break;
+ case MobInfo::DROPPERCENT0:
+ info = get_mob_db(mob_id).dropitem[0].p.num;
+ break;
case MobInfo::DROPID1:
info = unwrap<ItemNameId>(get_mob_db(mob_id).dropitem[0].nameid);
break;
@@ -2861,6 +2877,19 @@ void builtin_mobinfo(ScriptState *st)
case MobInfo::DROPPERCENT8:
info = get_mob_db(mob_id).dropitem[7].p.num;
break;
+ case MobInfo::DROPID9:
+ info = unwrap<ItemNameId>(get_mob_db(mob_id).dropitem[7].nameid);
+ break;
+ case MobInfo::DROPNAME9:
+ {
+ Option<P<struct item_data>> i_data = Some(itemdb_search(get_mob_db(mob_id).dropitem[7].nameid));
+ info_str = i_data.pmd_pget(&item_data::name).copy_or(stringish<ItemName>(""_s));
+ mode = 1;
+ }
+ break;
+ case MobInfo::DROPPERCENT9:
+ info = get_mob_db(mob_id).dropitem[7].p.num;
+ break;
default:
PRINTF("builtin_mobinfo: unknown request\n"_fmt);
push_int<ScriptDataInt>(st->stack, -1);
diff --git a/src/map/script-fun.t.hpp b/src/map/script-fun.t.hpp
index d0c753b..6cc2683 100644
--- a/src/map/script-fun.t.hpp
+++ b/src/map/script-fun.t.hpp
@@ -41,49 +41,56 @@ enum class MobInfo : uint8_t
ATK2 = 10,
DEF = 11,
MDEF = 12,
- STR = 13,
- AGI = 14,
- VIT = 15,
- INT = 16,
- DEX = 17,
- LUK = 18,
- RANGE2 = 19,
- RANGE3 = 20,
- SCALE = 21,
- RACE = 22,
- ELEMENT = 23,
- ELEMENT_LVL = 24,
- MODE = 25,
- SPEED = 26,
- ADELAY = 27,
- AMOTION = 28,
- DMOTION = 29,
- MUTATION_NUM = 30,
- MUTATION_POWER = 31,
- DROPID1 = 32,
- DROPNAME1 = 33,
- DROPPERCENT1 = 34,
- DROPID2 = 35,
- DROPNAME2 = 36,
- DROPPERCENT2 = 37,
- DROPID3 = 38,
- DROPNAME3 = 39,
- DROPPERCENT3 = 40,
- DROPID4 = 41,
- DROPNAME4 = 42,
- DROPPERCENT4 = 43,
- DROPID5 = 44,
- DROPNAME5 = 45,
- DROPPERCENT5 = 46,
- DROPID6 = 47,
- DROPNAME6 = 48,
- DROPPERCENT6 = 49,
- DROPID7 = 50,
- DROPNAME7 = 51,
- DROPPERCENT7 = 52,
- DROPID8 = 53,
- DROPNAME8 = 54,
- DROPPERCENT8 = 55,
+ CRITICAL_DEF = 13,
+ STR = 14,
+ AGI = 15,
+ VIT = 16,
+ INT = 17,
+ DEX = 18,
+ LUK = 19,
+ RANGE2 = 20,
+ RANGE3 = 21,
+ SCALE = 22,
+ RACE = 23,
+ ELEMENT = 24,
+ ELEMENT_LVL = 25,
+ MODE = 26,
+ SPEED = 27,
+ ADELAY = 28,
+ AMOTION = 29,
+ DMOTION = 30,
+ MUTATION_NUM = 31,
+ MUTATION_POWER = 32,
+ DROPID0 = 33,
+ DROPNAME0 = 34,
+ DROPPERCENT0 = 35,
+ DROPID1 = 36,
+ DROPNAME1 = 37,
+ DROPPERCENT1 = 38,
+ DROPID2 = 39,
+ DROPNAME2 = 40,
+ DROPPERCENT2 = 41,
+ DROPID3 = 42,
+ DROPNAME3 = 43,
+ DROPPERCENT3 = 44,
+ DROPID4 = 45,
+ DROPNAME4 = 46,
+ DROPPERCENT4 = 47,
+ DROPID5 = 48,
+ DROPNAME5 = 49,
+ DROPPERCENT5 = 50,
+ DROPID6 = 51,
+ DROPNAME6 = 52,
+ DROPPERCENT6 = 53,
+ DROPID7 = 54,
+ DROPNAME7 = 55,
+ DROPPERCENT7 = 56,
+ DROPID8 = 57,
+ DROPNAME8 = 58,
+ DROPPERCENT8 = 59,
+ DROPID9 = 60,
+ DROPNAME9 = 61,
+ DROPPERCENT9 = 62,
};
enum class MobInfo_DropArrays : uint8_t