From 83b2e0b3ceda907b7186acfcc56c214fc04d9c13 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 7 Feb 2013 19:38:32 -0800 Subject: Remove some macros --- src/map/battle.cpp | 466 +++++++++++++++++++++++++++-------------------------- 1 file changed, 235 insertions(+), 231 deletions(-) (limited to 'src/map/battle.cpp') diff --git a/src/map/battle.cpp b/src/map/battle.cpp index b431662..605d637 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -29,10 +29,10 @@ int battle_counttargeted(struct block_list *bl, struct block_list *src, ATK target_lv) { nullpo_ret(bl); - if (bl->type == BL_PC) + if (bl->type == BL::PC) return pc_counttargeted((struct map_session_data *) bl, src, target_lv); - else if (bl->type == BL_MOB) + else if (bl->type == BL::MOB) return mob_counttargeted((struct mob_data *) bl, src, target_lv); return 0; } @@ -45,9 +45,9 @@ int battle_counttargeted(struct block_list *bl, struct block_list *src, int battle_get_class(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) return ((struct mob_data *) bl)->mob_class; - else if (bl->type == BL_PC) + else if (bl->type == BL::PC) return 0; else return 0; @@ -60,13 +60,13 @@ int battle_get_class(struct block_list *bl) */ DIR battle_get_dir(struct block_list *bl) { - nullpo_retr(DIR_S, bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + nullpo_retr(DIR::S, bl); + if (bl->type == BL::MOB && (struct mob_data *) bl) return ((struct mob_data *) bl)->dir; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->dir; else - return DIR_S; + return DIR::S; } /*========================================== @@ -77,9 +77,9 @@ DIR battle_get_dir(struct block_list *bl) int battle_get_lv(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) - return ((struct mob_data *) bl)->stats[MOB_LV]; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) + return ((struct mob_data *) bl)->stats[mob_stat::LV]; + else if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->status.base_level; else return 0; @@ -93,9 +93,9 @@ int battle_get_lv(struct block_list *bl) int battle_get_range(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return mob_db[((struct mob_data *) bl)->mob_class].range; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->attackrange; else return 0; @@ -109,9 +109,9 @@ int battle_get_range(struct block_list *bl) int battle_get_hp(struct block_list *bl) { nullpo_retr(1, bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return ((struct mob_data *) bl)->hp; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->status.hp; else return 1; @@ -125,14 +125,14 @@ int battle_get_hp(struct block_list *bl) int battle_get_max_hp(struct block_list *bl) { nullpo_retr(1, bl); - if (bl->type == BL_PC && ((struct map_session_data *) bl)) + if (bl->type == BL::PC && ((struct map_session_data *) bl)) return ((struct map_session_data *) bl)->status.max_hp; else { int max_hp = 1; - if (bl->type == BL_MOB && ((struct mob_data *) bl)) + if (bl->type == BL::MOB && ((struct mob_data *) bl)) { - max_hp = ((struct mob_data *) bl)->stats[MOB_MAX_HP]; + max_hp = ((struct mob_data *) bl)->stats[mob_stat::MAX_HP]; if (mob_db[((struct mob_data *) bl)->mob_class].mexp > 0) { if (battle_config.mvp_hp_rate != 100) @@ -162,9 +162,9 @@ int battle_get_str(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB && ((struct mob_data *) bl)) - str = ((struct mob_data *) bl)->stats[MOB_STR]; - else if (bl->type == BL_PC && ((struct map_session_data *) bl)) + if (bl->type == BL::MOB && ((struct mob_data *) bl)) + str = ((struct mob_data *) bl)->stats[mob_stat::STR]; + else if (bl->type == BL::PC && ((struct map_session_data *) bl)) return ((struct map_session_data *) bl)->paramc[ATTR::STR]; if (str < 0) @@ -185,9 +185,9 @@ int battle_get_agi(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) - agi = ((struct mob_data *) bl)->stats[MOB_AGI]; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) + agi = ((struct mob_data *) bl)->stats[mob_stat::AGI]; + else if (bl->type == BL::PC && (struct map_session_data *) bl) agi = ((struct map_session_data *) bl)->paramc[ATTR::AGI]; if (agi < 0) @@ -207,9 +207,9 @@ int battle_get_vit(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) - vit = ((struct mob_data *) bl)->stats[MOB_VIT]; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) + vit = ((struct mob_data *) bl)->stats[mob_stat::VIT]; + else if (bl->type == BL::PC && (struct map_session_data *) bl) vit = ((struct map_session_data *) bl)->paramc[ATTR::VIT]; if (vit < 0) @@ -229,9 +229,9 @@ int battle_get_int(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) - int_ = ((struct mob_data *) bl)->stats[MOB_INT]; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) + int_ = ((struct mob_data *) bl)->stats[mob_stat::INT]; + else if (bl->type == BL::PC && (struct map_session_data *) bl) int_ = ((struct map_session_data *) bl)->paramc[ATTR::INT]; if (int_ < 0) @@ -251,9 +251,9 @@ int battle_get_dex(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) - dex = ((struct mob_data *) bl)->stats[MOB_DEX]; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) + dex = ((struct mob_data *) bl)->stats[mob_stat::DEX]; + else if (bl->type == BL::PC && (struct map_session_data *) bl) dex = ((struct map_session_data *) bl)->paramc[ATTR::DEX]; if (dex < 0) @@ -273,14 +273,14 @@ int battle_get_luk(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) - luk = ((struct mob_data *) bl)->stats[MOB_LUK]; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) + luk = ((struct mob_data *) bl)->stats[mob_stat::LUK]; + else if (bl->type == BL::PC && (struct map_session_data *) bl) luk = ((struct map_session_data *) bl)->paramc[ATTR::LUK]; if (sc_data) { - if (sc_data[SC_CURSE].timer != -1) // 呪い + if (sc_data[StatusChange::SC_CURSE].timer != -1) // 呪い luk = 0; } if (luk < 0) @@ -301,19 +301,19 @@ int battle_get_flee(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) flee = ((struct map_session_data *) bl)->flee; else flee = battle_get_agi(bl) + battle_get_lv(bl); if (sc_data) { - if (sc_data[SC_BLIND].timer != -1 && bl->type != BL_PC) + if (sc_data[StatusChange::SC_BLIND].timer != -1 && bl->type != BL::PC) flee -= flee * 25 / 100; if (battle_is_unarmed(bl)) - flee += (skill_power_bl(bl, TMW_BRAWLING) >> 3); // +25 for 200 - flee += skill_power_bl(bl, TMW_SPEED) >> 3; + flee += (skill_power_bl(bl, SkillID::TMW_BRAWLING) >> 3); // +25 for 200 + flee += skill_power_bl(bl, SkillID::TMW_SPEED) >> 3; } if (flee < 1) flee = 1; @@ -333,18 +333,18 @@ int battle_get_hit(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) hit = ((struct map_session_data *) bl)->hit; else hit = battle_get_dex(bl) + battle_get_lv(bl); if (sc_data) { - if (sc_data[SC_BLIND].timer != -1 && bl->type != BL_PC) // 呪い + if (sc_data[StatusChange::SC_BLIND].timer != -1 && bl->type != BL::PC) // 呪い hit -= hit * 25 / 100; if (battle_is_unarmed(bl)) - hit += (skill_power_bl(bl, TMW_BRAWLING) >> 4); // +12 for 200 + hit += (skill_power_bl(bl, SkillID::TMW_BRAWLING) >> 4); // +12 for 200 } if (hit < 1) hit = 1; @@ -364,7 +364,7 @@ int battle_get_flee2(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) { flee2 = battle_get_luk(bl) + 10; flee2 += @@ -376,8 +376,8 @@ int battle_get_flee2(struct block_list *bl) { if (battle_is_unarmed(bl)) - flee2 += (skill_power_bl(bl, TMW_BRAWLING) >> 3); // +25 for 200 - flee2 += skill_power_bl(bl, TMW_SPEED) >> 3; + flee2 += (skill_power_bl(bl, SkillID::TMW_BRAWLING) >> 3); // +25 for 200 + flee2 += skill_power_bl(bl, SkillID::TMW_SPEED) >> 3; } if (flee2 < 1) flee2 = 1; @@ -397,7 +397,7 @@ int battle_get_critical(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) { critical = battle_get_luk(bl) * 2 + 10; critical += @@ -425,7 +425,7 @@ int battle_get_baseatk(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) batk = ((struct map_session_data *) bl)->base_atk; //設定されているbase_atk else { //それ以外なら @@ -436,7 +436,7 @@ int battle_get_baseatk(struct block_list *bl) } if (sc_data) { //状態異常あり - if (sc_data[SC_CURSE].timer != -1) //呪われていたら + if (sc_data[StatusChange::SC_CURSE].timer != -1) //呪われていたら batk -= batk * 25 / 100; //base_atkが25%減少 } if (batk < 1) @@ -457,14 +457,14 @@ int battle_get_atk(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) atk = ((struct map_session_data *) bl)->watk; - else if (bl->type == BL_MOB && (struct mob_data *) bl) - atk = ((struct mob_data *) bl)->stats[MOB_ATK1]; + else if (bl->type == BL::MOB && (struct mob_data *) bl) + atk = ((struct mob_data *) bl)->stats[mob_stat::ATK1]; if (sc_data) { - if (sc_data[SC_CURSE].timer != -1) + if (sc_data[StatusChange::SC_CURSE].timer != -1) atk -= atk * 25 / 100; } if (atk < 0) @@ -481,11 +481,11 @@ static int battle_get_atk_(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) { int atk = ((struct map_session_data *) bl)->watk_; - if (((struct map_session_data *) bl)->sc_data[SC_CURSE].timer != -1) + if (((struct map_session_data *) bl)->sc_data[StatusChange::SC_CURSE].timer != -1) atk -= atk * 25 / 100; return atk; } @@ -502,17 +502,17 @@ static int battle_get_atk2(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->watk2; else { eptr sc_data = battle_get_sc_data(bl); int atk2 = 0; - if (bl->type == BL_MOB && (struct mob_data *) bl) - atk2 = ((struct mob_data *) bl)->stats[MOB_ATK2]; + if (bl->type == BL::MOB && (struct mob_data *) bl) + atk2 = ((struct mob_data *) bl)->stats[mob_stat::ATK2]; if (sc_data) { - if (sc_data[SC_CURSE].timer != -1) + if (sc_data[StatusChange::SC_CURSE].timer != -1) atk2 -= atk2 * 25 / 100; } @@ -531,7 +531,7 @@ static int battle_get_atk_2(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_PC) + if (bl->type == BL::PC) return ((struct map_session_data *) bl)->watk_2; else return 0; @@ -548,14 +548,14 @@ int battle_get_matk1(struct block_list *bl) eptr sc_data; nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) { int matk, int_ = battle_get_int(bl); matk = int_ + (int_ / 5) * (int_ / 5); return matk; } - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->matk1; else return 0; @@ -570,14 +570,14 @@ static int battle_get_matk2(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) { int matk, int_ = battle_get_int(bl); matk = int_ + (int_ / 7) * (int_ / 7); return matk; } - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->matk2; else return 0; @@ -595,13 +595,13 @@ int battle_get_def(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) { def = ((struct map_session_data *) bl)->def; } - else if (bl->type == BL_MOB && (struct mob_data *) bl) + else if (bl->type == BL::MOB && (struct mob_data *) bl) { - def = ((struct mob_data *) bl)->stats[MOB_DEF]; + def = ((struct mob_data *) bl)->stats[mob_stat::DEF]; } if (def < 1000000) @@ -609,12 +609,12 @@ int battle_get_def(struct block_list *bl) if (sc_data) { //毒にかかっている時は減算 - if (sc_data[SC_POISON].timer != -1 && bl->type != BL_PC) + if (sc_data[StatusChange::SC_POISON].timer != -1 && bl->type != BL::PC) def = def * 75 / 100; //凍結、石化時は右シフト - if (sc_data[SC_FREEZE].timer != -1 - || (sc_data[SC_STONE].timer != -1 - && sc_data[SC_STONE].val2 == 0)) + if (sc_data[StatusChange::SC_FREEZE].timer != -1 + || (sc_data[StatusChange::SC_STONE].timer != -1 + && sc_data[StatusChange::SC_STONE].val2 == 0)) def >>= 1; } } @@ -635,26 +635,26 @@ int battle_get_mdef(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) mdef = ((struct map_session_data *) bl)->mdef; - else if (bl->type == BL_MOB && (struct mob_data *) bl) - mdef = ((struct mob_data *) bl)->stats[MOB_MDEF]; + else if (bl->type == BL::MOB && (struct mob_data *) bl) + mdef = ((struct mob_data *) bl)->stats[mob_stat::MDEF]; if (mdef < 1000000) { if (sc_data) { //バリアー状態時はMDEF100 - if (mdef < 90 && sc_data[SC_MBARRIER].timer != -1) + if (mdef < 90 && sc_data[StatusChange::SC_MBARRIER].timer != -1) { - mdef += sc_data[SC_MBARRIER].val1; + mdef += sc_data[StatusChange::SC_MBARRIER].val1; if (mdef > 90) mdef = 90; } //凍結、石化時は1.25倍 - if (sc_data[SC_FREEZE].timer != -1 - || (sc_data[SC_STONE].timer != -1 - && sc_data[SC_STONE].val2 == 0)) + if (sc_data[StatusChange::SC_FREEZE].timer != -1 + || (sc_data[StatusChange::SC_STONE].timer != -1 + && sc_data[StatusChange::SC_STONE].val2 == 0)) mdef = mdef * 125 / 100; } } @@ -675,14 +675,14 @@ int battle_get_def2(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_PC) + if (bl->type == BL::PC) def2 = ((struct map_session_data *) bl)->def2; - else if (bl->type == BL_MOB) - def2 = ((struct mob_data *) bl)->stats[MOB_VIT]; + else if (bl->type == BL::MOB) + def2 = ((struct mob_data *) bl)->stats[mob_stat::VIT]; if (sc_data) { - if (sc_data[SC_POISON].timer != -1 && bl->type != BL_PC) + if (sc_data[StatusChange::SC_POISON].timer != -1 && bl->type != BL::PC) def2 = def2 * 75 / 100; } if (def2 < 1) @@ -700,11 +700,11 @@ int battle_get_mdef2(struct block_list *bl) int mdef2 = 0; nullpo_ret(bl); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) mdef2 = - ((struct mob_data *) bl)->stats[MOB_INT] + - (((struct mob_data *) bl)->stats[MOB_VIT] >> 1); - else if (bl->type == BL_PC) + ((struct mob_data *) bl)->stats[mob_stat::INT] + + (((struct mob_data *) bl)->stats[mob_stat::VIT] >> 1); + else if (bl->type == BL::PC) mdef2 = ((struct map_session_data *) bl)->mdef2 + (((struct map_session_data *) bl)->paramc[ATTR::VIT] >> 1); @@ -723,18 +723,18 @@ int battle_get_mdef2(struct block_list *bl) int battle_get_speed(struct block_list *bl) { nullpo_retr(1000, bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->speed; else { eptr sc_data = battle_get_sc_data(bl); int speed = 1000; - if (bl->type == BL_MOB && (struct mob_data *) bl) - speed = ((struct mob_data *) bl)->stats[MOB_SPEED]; + if (bl->type == BL::MOB && (struct mob_data *) bl) + speed = ((struct mob_data *) bl)->stats[mob_stat::SPEED]; if (sc_data) { - if (sc_data[SC_CURSE].timer != -1) + if (sc_data[StatusChange::SC_CURSE].timer != -1) speed = speed + 450; } if (speed < 1) @@ -751,22 +751,22 @@ int battle_get_speed(struct block_list *bl) int battle_get_adelay(struct block_list *bl) { nullpo_retr(4000, bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) return (((struct map_session_data *) bl)->aspd << 1); else { eptr sc_data = battle_get_sc_data(bl); int adelay = 4000, aspd_rate = 100; - if (bl->type == BL_MOB && (struct mob_data *) bl) - adelay = ((struct mob_data *) bl)->stats[MOB_ADELAY]; + if (bl->type == BL::MOB && (struct mob_data *) bl) + adelay = ((struct mob_data *) bl)->stats[mob_stat::ADELAY]; if (sc_data) { - if (sc_data[SC_SPEEDPOTION0].timer != -1) - aspd_rate -= sc_data[SC_SPEEDPOTION0].val1; + if (sc_data[StatusChange::SC_SPEEDPOTION0].timer != -1) + aspd_rate -= sc_data[StatusChange::SC_SPEEDPOTION0].val1; // Fate's `haste' spell works the same as the above - if (sc_data[SC_HASTE].timer != -1) - aspd_rate -= sc_data[SC_HASTE].val1; + if (sc_data[StatusChange::SC_HASTE].timer != -1) + aspd_rate -= sc_data[StatusChange::SC_HASTE].val1; } if (aspd_rate != 100) @@ -780,21 +780,21 @@ int battle_get_adelay(struct block_list *bl) int battle_get_amotion(struct block_list *bl) { nullpo_retr(2000, bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->amotion; else { eptr sc_data = battle_get_sc_data(bl); int amotion = 2000, aspd_rate = 100; - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) amotion = mob_db[((struct mob_data *) bl)->mob_class].amotion; if (sc_data) { - if (sc_data[SC_SPEEDPOTION0].timer != -1) - aspd_rate -= sc_data[SC_SPEEDPOTION0].val1; - if (sc_data[SC_HASTE].timer != -1) - aspd_rate -= sc_data[SC_HASTE].val1; + if (sc_data[StatusChange::SC_SPEEDPOTION0].timer != -1) + aspd_rate -= sc_data[StatusChange::SC_SPEEDPOTION0].val1; + if (sc_data[StatusChange::SC_HASTE].timer != -1) + aspd_rate -= sc_data[StatusChange::SC_HASTE].val1; } if (aspd_rate != 100) @@ -812,13 +812,13 @@ int battle_get_dmotion(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) { ret = mob_db[((struct mob_data *) bl)->mob_class].dmotion; if (battle_config.monster_damage_delay_rate != 100) ret = ret * battle_config.monster_damage_delay_rate / 400; } - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) { ret = ((struct map_session_data *) bl)->dmotion; if (battle_config.pc_damage_delay_rate != 100) @@ -837,14 +837,14 @@ LevelElement battle_get_element(struct block_list *bl) nullpo_retr(ret, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) // 10の位=Lv*2、1の位=属性 + if (bl->type == BL::MOB && (struct mob_data *) bl) // 10の位=Lv*2、1の位=属性 ret = ((struct mob_data *) bl)->def_ele; if (sc_data) { - if (sc_data[SC_FREEZE].timer != -1) // 凍結 + if (sc_data[StatusChange::SC_FREEZE].timer != -1) // 凍結 ret = LevelElement{2, Element::water}; - if (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0) + if (sc_data[StatusChange::SC_STONE].timer != -1 && sc_data[StatusChange::SC_STONE].val2 == 0) ret = LevelElement{2, Element::earth}; } @@ -854,9 +854,9 @@ LevelElement battle_get_element(struct block_list *bl) int battle_get_party_id(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) + if (bl->type == BL::PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->status.party_id; - else if (bl->type == BL_MOB && (struct mob_data *) bl) + else if (bl->type == BL::MOB && (struct mob_data *) bl) { struct mob_data *md = (struct mob_data *) bl; if (md->master_id > 0) @@ -869,9 +869,9 @@ int battle_get_party_id(struct block_list *bl) Race battle_get_race(struct block_list *bl) { nullpo_retr(Race::formless, bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return mob_db[((struct mob_data *) bl)->mob_class].race; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return Race::demihuman; else return Race::formless; @@ -880,7 +880,7 @@ Race battle_get_race(struct block_list *bl) MobMode battle_get_mode(struct block_list *bl) { nullpo_retr(MobMode::CAN_MOVE, bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return mob_db[((struct mob_data *) bl)->mob_class].mode; // とりあえず動くということで1 return MobMode::CAN_MOVE; @@ -889,13 +889,13 @@ MobMode battle_get_mode(struct block_list *bl) int battle_get_mexp(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) { const struct mob_data *mob = (struct mob_data *) bl; const int retval = (mob_db[mob->mob_class].mexp * - (int)(mob->stats[MOB_XP_BONUS])) >> MOB_XP_BONUS_SHIFT; - FPRINTF(stderr, "Modifier of %x: -> %d\n", mob->stats[MOB_XP_BONUS], + (int)(mob->stats[mob_stat::XP_BONUS])) >> MOB_XP_BONUS_SHIFT; + FPRINTF(stderr, "Modifier of %x: -> %d\n", mob->stats[mob_stat::XP_BONUS], retval); return retval; } @@ -907,17 +907,17 @@ int battle_get_stat(SP stat_id, struct block_list *bl) { switch (stat_id) { - case SP_STR: + case SP::STR: return battle_get_str(bl); - case SP_AGI: + case SP::AGI: return battle_get_agi(bl); - case SP_DEX: + case SP::DEX: return battle_get_dex(bl); - case SP_VIT: + case SP::VIT: return battle_get_vit(bl); - case SP_INT: + case SP::INT: return battle_get_int(bl); - case SP_LUK: + case SP::LUK: return battle_get_luk(bl); default: return 0; @@ -931,9 +931,9 @@ eptr battle_get_sc_data(struct block_list *b switch (bl->type) { - case BL_MOB: + case BL::MOB: return ((struct mob_data *)(bl))->sc_data; - case BL_PC: + case BL::PC: return ((struct map_session_data *)(bl))->sc_data; } return nullptr; @@ -942,9 +942,9 @@ eptr battle_get_sc_data(struct block_list *b short *battle_get_sc_count(struct block_list *bl) { nullpo_retr(NULL, bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return &((struct mob_data *) bl)->sc_count; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return &((struct map_session_data *) bl)->sc_count; return NULL; } @@ -952,11 +952,11 @@ short *battle_get_sc_count(struct block_list *bl) Opt1 *battle_get_opt1(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return &((struct mob_data *) bl)->opt1; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return &((struct map_session_data *) bl)->opt1; - else if (bl->type == BL_NPC && (struct npc_data *) bl) + else if (bl->type == BL::NPC && (struct npc_data *) bl) return &((struct npc_data *) bl)->opt1; return 0; } @@ -964,11 +964,11 @@ Opt1 *battle_get_opt1(struct block_list *bl) Opt2 *battle_get_opt2(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return &((struct mob_data *) bl)->opt2; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return &((struct map_session_data *) bl)->opt2; - else if (bl->type == BL_NPC && (struct npc_data *) bl) + else if (bl->type == BL::NPC && (struct npc_data *) bl) return &((struct npc_data *) bl)->opt2; return 0; } @@ -976,11 +976,11 @@ Opt2 *battle_get_opt2(struct block_list *bl) Opt3 *battle_get_opt3(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return &((struct mob_data *) bl)->opt3; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return &((struct map_session_data *) bl)->opt3; - else if (bl->type == BL_NPC && (struct npc_data *) bl) + else if (bl->type == BL::NPC && (struct npc_data *) bl) return &((struct npc_data *) bl)->opt3; return 0; } @@ -988,11 +988,11 @@ Opt3 *battle_get_opt3(struct block_list *bl) Option *battle_get_option(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL::MOB && (struct mob_data *) bl) return &((struct mob_data *) bl)->option; - else if (bl->type == BL_PC && (struct map_session_data *) bl) + else if (bl->type == BL::PC && (struct map_session_data *) bl) return &((struct map_session_data *) bl)->status.option; - else if (bl->type == BL_NPC && (struct npc_data *) bl) + else if (bl->type == BL::NPC && (struct npc_data *) bl) return &((struct npc_data *) bl)->option; return 0; } @@ -1035,22 +1035,22 @@ int battle_damage(struct block_list *bl, struct block_list *target, && *sc_count > 0) { // 凍結、石化、睡眠を消去 - if (sc_data[SC_FREEZE].timer != -1) - skill_status_change_end(target, SC_FREEZE, -1); - if (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0) - skill_status_change_end(target, SC_STONE, -1); - if (sc_data[SC_SLEEP].timer != -1) - skill_status_change_end(target, SC_SLEEP, -1); + if (sc_data[StatusChange::SC_FREEZE].timer != -1) + skill_status_change_end(target, StatusChange::SC_FREEZE, -1); + if (sc_data[StatusChange::SC_STONE].timer != -1 && sc_data[StatusChange::SC_STONE].val2 == 0) + skill_status_change_end(target, StatusChange::SC_STONE, -1); + if (sc_data[StatusChange::SC_SLEEP].timer != -1) + skill_status_change_end(target, StatusChange::SC_SLEEP, -1); } - if (target->type == BL_MOB) + if (target->type == BL::MOB) { // MOB struct mob_data *md = (struct mob_data *) target; if (md && md->skilltimer != -1 && md->state.skillcastcancel) // 詠唱妨害 skill_castcancel(target, 0); return mob_damage(bl, md, damage, 0); } - else if (target->type == BL_PC) + else if (target->type == BL::PC) { // PC struct map_session_data *tsd = (struct map_session_data *) target; @@ -1066,7 +1066,7 @@ int battle_heal(struct block_list *bl, struct block_list *target, int hp, { nullpo_ret(target); //blはNULLで呼ばれることがあるので他でチェック - if (target->type == BL_PC + if (target->type == BL::PC && pc_isdead((struct map_session_data *) target)) return 0; if (hp == 0 && sp == 0) @@ -1075,9 +1075,9 @@ int battle_heal(struct block_list *bl, struct block_list *target, int hp, if (hp < 0) return battle_damage(bl, target, -hp, flag); - if (target->type == BL_MOB) + if (target->type == BL::MOB) return mob_heal((struct mob_data *) target, hp); - else if (target->type == BL_PC) + else if (target->type == BL::PC) return pc_heal((struct map_session_data *) target, hp, sp); return 0; } @@ -1086,9 +1086,9 @@ int battle_heal(struct block_list *bl, struct block_list *target, int hp, int battle_stopattack(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) return mob_stopattack((struct mob_data *) bl); - else if (bl->type == BL_PC) + else if (bl->type == BL::PC) return pc_stopattack((struct map_session_data *) bl); return 0; } @@ -1097,9 +1097,9 @@ int battle_stopattack(struct block_list *bl) int battle_stopwalking(struct block_list *bl, int type) { nullpo_ret(bl); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) return mob_stop_walking((struct mob_data *) bl, type); - else if (bl->type == BL_PC) + else if (bl->type == BL::PC) return pc_stop_walking((struct map_session_data *) bl, type); return 0; } @@ -1117,11 +1117,11 @@ int battle_calc_damage(struct block_list *, struct block_list *bl, nullpo_ret(bl); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) md = (struct mob_data *) bl; if (battle_config.skill_min_damage - || bool(flag & BF_MISC)) + || bool(flag & BF::MISC)) { if (div_ < 255) { @@ -1167,14 +1167,14 @@ struct Damage battle_calc_mob_weapon_attack(struct block_list *src, sc_data = battle_get_sc_data(src); // ターゲット - if (target->type == BL_PC) + if (target->type == BL::PC) tsd = (struct map_session_data *) target; - else if (target->type == BL_MOB) + else if (target->type == BL::MOB) tmd = (struct mob_data *) target; MobMode t_mode = battle_get_mode(target); t_sc_data = battle_get_sc_data(target); - flag = BF_SHORT | BF_WEAPON | BF_NORMAL; // 攻撃の種類の設定 + flag = BF::SHORT | BF::WEAPON | BF::NORMAL; // 攻撃の種類の設定 // 回避率計算、回避判定は後で flee = battle_get_flee(target); @@ -1217,7 +1217,7 @@ struct Damage battle_calc_mob_weapon_attack(struct block_list *src, atkmax = battle_get_atk2(src); } if (mob_db[md->mob_class].range > 3) - flag = (flag & ~BF_RANGEMASK) | BF_LONG; + flag = (flag & ~BF::RANGEMASK) | BF::LONG; if (atkmin > atkmax) atkmin = atkmax; @@ -1230,7 +1230,7 @@ struct Damage battle_calc_mob_weapon_attack(struct block_list *src, if (cri < 1) cri = 1; } - if (t_sc_data && t_sc_data[SC_SLEEP].timer != -1) // 睡眠中はクリティカルが倍に + if (t_sc_data && t_sc_data[StatusChange::SC_SLEEP].timer != -1) // 睡眠中はクリティカルが倍に cri <<= 1; if (ac_flag) @@ -1259,7 +1259,7 @@ struct Damage battle_calc_mob_weapon_attack(struct block_list *src, if (skill_num != SkillID::ZERO && skill_num != SkillID::NEGATIVE) { - flag = (flag & ~BF_SKILLMASK) | BF_SKILL; + flag = (flag & ~BF::SKILLMASK) | BF::SKILL; } { @@ -1350,18 +1350,18 @@ struct Damage battle_calc_mob_weapon_attack(struct block_list *src, if (hitrate < 1000000) hitrate = ((hitrate > 95) ? 95 : ((hitrate < 5) ? 5 : hitrate)); if (hitrate < 1000000 && // 必中攻撃 - (t_sc_data && (t_sc_data[SC_SLEEP].timer != -1 || // 睡眠は必中 - t_sc_data[SC_STAN].timer != -1 || // スタンは必中 - t_sc_data[SC_FREEZE].timer != -1 || (t_sc_data[SC_STONE].timer != -1 && t_sc_data[SC_STONE].val2 == 0)))) // 凍結は必中 + (t_sc_data && (t_sc_data[StatusChange::SC_SLEEP].timer != -1 || // 睡眠は必中 + t_sc_data[StatusChange::SC_STAN].timer != -1 || // スタンは必中 + t_sc_data[StatusChange::SC_FREEZE].timer != -1 || (t_sc_data[StatusChange::SC_STONE].timer != -1 && t_sc_data[StatusChange::SC_STONE].val2 == 0)))) // 凍結は必中 hitrate = 1000000; if (type == DamageType::NORMAL && MRAND(100) >= hitrate) { damage = damage2 = 0; - dmg_lv = ATK_FLEE; + dmg_lv = ATK::FLEE; } else { - dmg_lv = ATK_DEF; + dmg_lv = ATK::DEF; } if (damage < 0) @@ -1373,7 +1373,7 @@ struct Damage battle_calc_mob_weapon_attack(struct block_list *src, { damage = 0; type = DamageType::FLEE2; - dmg_lv = ATK_LUCKY; + dmg_lv = ATK::LUCKY; } if (battle_config.enemy_perfect_flee) @@ -1383,7 +1383,7 @@ struct Damage battle_calc_mob_weapon_attack(struct block_list *src, { damage = 0; type = DamageType::FLEE2; - dmg_lv = ATK_LUCKY; + dmg_lv = ATK::LUCKY; } } @@ -1409,12 +1409,12 @@ int battle_is_unarmed(struct block_list *bl) { if (!bl) return 0; - if (bl->type == BL_PC) + if (bl->type == BL::PC) { struct map_session_data *sd = (struct map_session_data *) bl; - return (sd->equip_index[EQUIP_SHIELD] == -1 - && sd->equip_index[EQUIP_WEAPON] == -1); + return (sd->equip_index[EQUIP::SHIELD] == -1 + && sd->equip_index[EQUIP::WEAPON] == -1); } else return 0; @@ -1460,17 +1460,17 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, // アタッカー sc_data = battle_get_sc_data(src); //ステータス異常 - sd->state.attack_type = BF_WEAPON; //攻撃タイプは武器攻撃 + sd->state.attack_type = BF::WEAPON; //攻撃タイプは武器攻撃 // ターゲット - if (target->type == BL_PC) //対象がPCなら + if (target->type == BL::PC) //対象がPCなら tsd = (struct map_session_data *) target; //tsdに代入(tmdはNULL) - else if (target->type == BL_MOB) //対象がMobなら + else if (target->type == BL::MOB) //対象がMobなら tmd = (struct mob_data *) target; //tmdに代入(tsdはNULL) MobMode t_mode = battle_get_mode(target); //対象のMode t_sc_data = battle_get_sc_data(target); //対象のステータス異常 - flag = BF_SHORT | BF_WEAPON | BF_NORMAL; // 攻撃の種類の設定 + flag = BF::SHORT | BF::WEAPON | BF::NORMAL; // 攻撃の種類の設定 // 回避率計算、回避判定は後で flee = battle_get_flee(target); @@ -1506,7 +1506,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, target_distance = max(dx, dy); malus_dist = - max(0, target_distance - (skill_power(sd, AC_OWL) / 75)); + max(0, target_distance - (skill_power(sd, SkillID::AC_OWL) / 75)); hitrate -= (malus_dist * (malus_dist + 1)); } @@ -1547,7 +1547,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, if (sd->status.weapon == 11) { //武器が弓矢の場合 atkmin = watk * ((atkmin < watk) ? atkmin : watk) / 100; //弓用最低ATK計算 - flag = (flag & ~BF_RANGEMASK) | BF_LONG; //遠距離攻撃フラグを有効 + flag = (flag & ~BF::RANGEMASK) | BF::LONG; //遠距離攻撃フラグを有効 sd->state.arrow_atk = 1; //arrow_atk有効化 } @@ -1581,7 +1581,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, // カタールの場合、クリティカルを倍に cri <<= 1; cri -= battle_get_luk(target) * 3; - if (t_sc_data && t_sc_data[SC_SLEEP].timer != -1) // 睡眠中はクリティカルが倍に + if (t_sc_data && t_sc_data[StatusChange::SC_SLEEP].timer != -1) // 睡眠中はクリティカルが倍に cri <<= 1; if (ac_flag) cri = 1000; @@ -1631,7 +1631,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, if (skill_num != SkillID::ZERO && skill_num != SkillID::NEGATIVE) { - flag = (flag & ~BF_SKILLMASK) | BF_SKILL; + flag = (flag & ~BF::SKILLMASK) | BF::SKILL; } { @@ -1764,18 +1764,18 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, // 回避修正 hitrate = (hitrate < 5) ? 5 : hitrate; if (hitrate < 1000000 && // 必中攻撃 - (t_sc_data && (t_sc_data[SC_SLEEP].timer != -1 || // 睡眠は必中 - t_sc_data[SC_STAN].timer != -1 || // スタンは必中 - t_sc_data[SC_FREEZE].timer != -1 || (t_sc_data[SC_STONE].timer != -1 && t_sc_data[SC_STONE].val2 == 0)))) // 凍結は必中 + (t_sc_data && (t_sc_data[StatusChange::SC_SLEEP].timer != -1 || // 睡眠は必中 + t_sc_data[StatusChange::SC_STAN].timer != -1 || // スタンは必中 + t_sc_data[StatusChange::SC_FREEZE].timer != -1 || (t_sc_data[StatusChange::SC_STONE].timer != -1 && t_sc_data[StatusChange::SC_STONE].val2 == 0)))) // 凍結は必中 hitrate = 1000000; if (type == DamageType::NORMAL && MRAND(100) >= hitrate) { damage = damage2 = 0; - dmg_lv = ATK_FLEE; + dmg_lv = ATK::FLEE; } else { - dmg_lv = ATK_DEF; + dmg_lv = ATK::DEF; } if (damage < 0) @@ -1839,7 +1839,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, { damage = damage2 = 0; type = DamageType::FLEE2; - dmg_lv = ATK_LUCKY; + dmg_lv = ATK::LUCKY; } // 対象が完全回避をする設定がONなら @@ -1850,7 +1850,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, { damage = damage2 = 0; type = DamageType::FLEE2; - dmg_lv = ATK_LUCKY; + dmg_lv = ATK::LUCKY; } } @@ -1913,12 +1913,12 @@ struct Damage battle_calc_weapon_attack(struct block_list *src, nullpo_retr(wd, src); nullpo_retr(wd, target); - if (src->type == BL_PC) + if (src->type == BL::PC) wd = battle_calc_pc_weapon_attack(src, target, skill_num, skill_lv, wflag); // weapon breaking [Valaris] - else if (src->type == BL_MOB) + else if (src->type == BL::MOB) wd = battle_calc_mob_weapon_attack(src, target, skill_num, skill_lv, wflag); - if (battle_config.equipment_breaking && src->type == BL_PC + if (battle_config.equipment_breaking && src->type == BL::PC && (wd.damage > 0 || wd.damage2 > 0)) { struct map_session_data *sd = (struct map_session_data *) src; @@ -1937,7 +1937,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src, } } - if (battle_config.equipment_breaking && target->type == BL_PC + if (battle_config.equipment_breaking && target->type == BL::PC && (wd.damage > 0 || wd.damage2 > 0)) { int breakrate = 1; @@ -1977,17 +1977,21 @@ struct Damage battle_calc_magic_attack(struct block_list *bl, matk2 = battle_get_matk2(bl); MobMode t_mode = battle_get_mode(target); -#define MATK_FIX( a,b ) { matk1=matk1*(a)/(b); matk2=matk2*(a)/(b); } +#define MATK_FIX(a, b) \ +{ \ + matk1 = matk1 * (a) / (b); \ + matk2 = matk2 * (a) / (b); \ +} - if (bl->type == BL_PC && (sd = (struct map_session_data *) bl)) + if (bl->type == BL::PC && (sd = (struct map_session_data *) bl)) { - sd->state.attack_type = BF_MAGIC; + sd->state.attack_type = BF::MAGIC; if (sd->matk_rate != 100) MATK_FIX(sd->matk_rate, 100); sd->state.arrow_atk = 0; } - BF aflag = BF_MAGIC | BF_LONG | BF_SKILL; + BF aflag = BF::MAGIC | BF::LONG | BF::SKILL; if (normalmagic_flag) { // 一般魔法ダメージ計算 @@ -2054,20 +2058,20 @@ struct Damage battle_calc_misc_attack(struct block_list *bl, struct Damage md {}; int damagefix = 1; - BF aflag = BF_MISC | BF_LONG | BF_SKILL; + BF aflag = BF::MISC | BF::LONG | BF::SKILL; nullpo_retr(md, bl); nullpo_retr(md, target); - if (bl->type == BL_PC && (sd = (struct map_session_data *) bl)) + if (bl->type == BL::PC && (sd = (struct map_session_data *) bl)) { - sd->state.attack_type = BF_MISC; + sd->state.attack_type = BF::MISC; sd->state.arrow_atk = 0; } switch (skill_num) { - case NPC_SELFDESTRUCTION: // 自爆 + case SkillID::NPC_SELFDESTRUCTION: // 自爆 damage = battle_get_hp(bl) - (bl == target ? 1 : 0); damagefix = 0; break; @@ -2118,13 +2122,13 @@ struct Damage battle_calc_attack(BF attack_type, switch (attack_type) { - case BF_WEAPON: + case BF::WEAPON: return battle_calc_weapon_attack(bl, target, skill_num, skill_lv, flag); - case BF_MAGIC: + case BF::MAGIC: return battle_calc_magic_attack(bl, target, skill_num, skill_lv, flag); - case BF_MISC: + case BF::MISC: return battle_calc_misc_attack(bl, target, skill_num, skill_lv, flag); default: @@ -2150,14 +2154,14 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, nullpo_retr(ATK::ZERO, src); nullpo_retr(ATK::ZERO, target); - if (src->type == BL_PC) + if (src->type == BL::PC) sd = (struct map_session_data *) src; if (src->prev == NULL || target->prev == NULL) return ATK::ZERO; - if (src->type == BL_PC && pc_isdead(sd)) + if (src->type == BL::PC && pc_isdead(sd)) return ATK::ZERO; - if (target->type == BL_PC + if (target->type == BL::PC && pc_isdead((struct map_session_data *) target)) return ATK::ZERO; @@ -2188,15 +2192,15 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, wd = battle_calc_weapon_attack(src, target, SkillID::ZERO, 0, 0); // significantly increase injuries for hasted characters - if (wd.damage > 0 && (t_sc_data[SC_HASTE].timer != -1)) + if (wd.damage > 0 && (t_sc_data[StatusChange::SC_HASTE].timer != -1)) { - wd.damage = (wd.damage * (16 + t_sc_data[SC_HASTE].val1)) >> 4; + wd.damage = (wd.damage * (16 + t_sc_data[StatusChange::SC_HASTE].val1)) >> 4; } if (wd.damage > 0 - && t_sc_data[SC_PHYS_SHIELD].timer != -1 && target->type == BL_PC) + && t_sc_data[StatusChange::SC_PHYS_SHIELD].timer != -1 && target->type == BL::PC) { - int reduction = t_sc_data[SC_PHYS_SHIELD].val1; + int reduction = t_sc_data[StatusChange::SC_PHYS_SHIELD].val1; if (reduction > wd.damage) reduction = wd.damage; @@ -2216,7 +2220,7 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, map_freeblock_lock(); - if (src->type == BL_PC) + if (src->type == BL::PC) { int weapon_index = sd->equip_index[EQUIP::WEAPON]; int weapon = 0; @@ -2226,21 +2230,21 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, MAP_LOG("PC%d %d:%d,%d WPNDMG %s%d %d FOR %d WPN %d", sd->status.char_id, src->m, src->x, src->y, - (target->type == BL_PC) ? "PC" : "MOB", + (target->type == BL::PC) ? "PC" : "MOB", (target->type == - BL_PC) ? ((struct map_session_data *) target)-> + BL::PC) ? ((struct map_session_data *) target)-> status.char_id : target->id, battle_get_class(target), wd.damage + wd.damage2, weapon); } - if (target->type == BL_PC) + if (target->type == BL::PC) { struct map_session_data *sd2 = (struct map_session_data *) target; MAP_LOG("PC%d %d:%d,%d WPNINJURY %s%d %d FOR %d", sd2->status.char_id, target->m, target->x, target->y, - (src->type == BL_PC) ? "PC" : "MOB", - (src->type == BL_PC) + (src->type == BL::PC) ? "PC" : "MOB", + (src->type == BL::PC) ? ((struct map_session_data *) src)->status.char_id : src->id, battle_get_class(src), @@ -2249,18 +2253,18 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, battle_damage(src, target, (wd.damage + wd.damage2), 0); if (target->prev != NULL && - (target->type != BL_PC - || (target->type == BL_PC + (target->type != BL::PC + || (target->type == BL::PC && !pc_isdead((struct map_session_data *) target)))) { if (wd.damage > 0 || wd.damage2 > 0) { - skill_additional_effect(src, target, SkillID::ZERO, 0, BF_WEAPON, tick); + skill_additional_effect(src, target, SkillID::ZERO, 0, BF::WEAPON, tick); } } if (sd) { - if (bool(wd.flag & BF_WEAPON) + if (bool(wd.flag & BF::WEAPON) && src != target && (wd.damage > 0 || wd.damage2 > 0)) { @@ -2339,18 +2343,18 @@ int battle_check_target(struct block_list *src, struct block_list *target, if (flag & BCT_ALL) { - if (target->type == BL_MOB || target->type == BL_PC) + if (target->type == BL::MOB || target->type == BL::PC) return 1; else return -1; } - if (target->type == BL_PC + if (target->type == BL::PC && ((struct map_session_data *) target)->invincible_timer != -1) return -1; // Mobでmaster_idがあってspecial_mob_aiなら、召喚主を求める - if (src->type == BL_MOB) + if (src->type == BL::MOB) { struct mob_data *md = (struct mob_data *) src; if (md && md->master_id > 0) @@ -2359,7 +2363,7 @@ int battle_check_target(struct block_list *src, struct block_list *target, return 1; if (md->state.special_mob_ai) { - if (target->type == BL_MOB) + if (target->type == BL::MOB) { //special_mob_aiで対象がMob struct mob_data *tmd = (struct mob_data *) target; if (tmd) @@ -2384,16 +2388,16 @@ int battle_check_target(struct block_list *src, struct block_list *target, if (src == target || ss == target) // 同じなら肯定 return 1; - if (target->type == BL_PC + if (target->type == BL::PC && pc_isinvisible((struct map_session_data *) target)) return -1; if (src->prev == NULL || // 死んでるならエラー - (src->type == BL_PC && pc_isdead((struct map_session_data *) src))) + (src->type == BL::PC && pc_isdead((struct map_session_data *) src))) return -1; - if ((ss->type == BL_PC && target->type == BL_MOB) || - (ss->type == BL_MOB && target->type == BL_PC)) + if ((ss->type == BL::PC && target->type == BL::MOB) || + (ss->type == BL::MOB && target->type == BL::PC)) return 0; // PCvsMOBなら否定 s_p = battle_get_party_id(ss); @@ -2411,7 +2415,7 @@ int battle_check_target(struct block_list *src, struct block_list *target, //PRINTF("ss:%d src:%d target:%d flag:0x%x %d %d ",ss->id,src->id,target->id,flag,src->type,target->type); //PRINTF("p:%d %d g:%d %d\n",s_p,t_p,s_g,t_g); - if (ss->type == BL_PC && target->type == BL_PC) + if (ss->type == BL::PC && target->type == BL::PC) { // 両方PVPモードなら否定(敵) if (map[ss->m].flag.pvp || pc_iskiller((struct map_session_data *) ss, @@ -2579,11 +2583,11 @@ int battle_config_read(const char *cfgName) battle_config.agi_penaly_type = 0; battle_config.agi_penaly_count = 3; battle_config.agi_penaly_num = 0; - battle_config.agi_penaly_count_lv = int(ATK_FLEE); // FIXME + battle_config.agi_penaly_count_lv = int(ATK::FLEE); // FIXME battle_config.vit_penaly_type = 0; battle_config.vit_penaly_count = 3; battle_config.vit_penaly_num = 0; - battle_config.vit_penaly_count_lv = int(ATK_DEF); // FIXME + battle_config.vit_penaly_count_lv = int(ATK::DEF); // FIXME battle_config.player_defense_type = 0; battle_config.monster_defense_type = 0; battle_config.magic_defense_type = 0; -- cgit v1.2.3-70-g09d2