From edd67db458188a76934b963e6a40f7b681f86b3d Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 12 Oct 2013 18:41:40 -0700 Subject: Disallow unchecked being casts Despite the fact that that's what the code always did, it was sometimes wrong. --- src/map/battle.cpp | 214 ++++++++++++++++++++++++++--------------------------- 1 file changed, 107 insertions(+), 107 deletions(-) (limited to 'src/map/battle.cpp') diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 7bdac86..c95ad61 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -35,10 +35,10 @@ int battle_counttargeted(dumb_ptr bl, dumb_ptr src, { nullpo_ret(bl); if (bl->bl_type == BL::PC) - return pc_counttargeted(bl->as_player(), src, + return pc_counttargeted(bl->is_player(), src, target_lv); else if (bl->bl_type == BL::MOB) - return mob_counttargeted(bl->as_mob(), src, target_lv); + return mob_counttargeted(bl->is_mob(), src, target_lv); return 0; } @@ -51,7 +51,7 @@ int battle_get_class(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return bl->as_mob()->mob_class; + return bl->is_mob()->mob_class; else if (bl->bl_type == BL::PC) return 0; else @@ -67,9 +67,9 @@ DIR battle_get_dir(dumb_ptr bl) { nullpo_retr(DIR::S, bl); if (bl->bl_type == BL::MOB) - return bl->as_mob()->dir; + return bl->is_mob()->dir; else if (bl->bl_type == BL::PC) - return bl->as_player()->dir; + return bl->is_player()->dir; else return DIR::S; } @@ -83,9 +83,9 @@ int battle_get_lv(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return bl->as_mob()->stats[mob_stat::LV]; + return bl->is_mob()->stats[mob_stat::LV]; else if (bl->bl_type == BL::PC) - return bl->as_player()->status.base_level; + return bl->is_player()->status.base_level; else return 0; } @@ -99,9 +99,9 @@ int battle_get_range(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return mob_db[bl->as_mob()->mob_class].range; + return mob_db[bl->is_mob()->mob_class].range; else if (bl->bl_type == BL::PC) - return bl->as_player()->attackrange; + return bl->is_player()->attackrange; else return 0; } @@ -115,9 +115,9 @@ int battle_get_hp(dumb_ptr bl) { nullpo_retr(1, bl); if (bl->bl_type == BL::MOB) - return bl->as_mob()->hp; + return bl->is_mob()->hp; else if (bl->bl_type == BL::PC) - return bl->as_player()->status.hp; + return bl->is_player()->status.hp; else return 1; } @@ -131,13 +131,13 @@ int battle_get_max_hp(dumb_ptr bl) { nullpo_retr(1, bl); if (bl->bl_type == BL::PC) - return bl->as_player()->status.max_hp; + return bl->is_player()->status.max_hp; else { int max_hp = 1; if (bl->bl_type == BL::MOB) { - max_hp = bl->as_mob()->stats[mob_stat::MAX_HP]; + max_hp = bl->is_mob()->stats[mob_stat::MAX_HP]; { if (battle_config.monster_hp_rate != 100) max_hp = (max_hp * battle_config.monster_hp_rate) / 100; @@ -162,9 +162,9 @@ int battle_get_str(dumb_ptr bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) - str = bl->as_mob()->stats[mob_stat::STR]; + str = bl->is_mob()->stats[mob_stat::STR]; else if (bl->bl_type == BL::PC) - return bl->as_player()->paramc[ATTR::STR]; + return bl->is_player()->paramc[ATTR::STR]; if (str < 0) str = 0; @@ -185,9 +185,9 @@ int battle_get_agi(dumb_ptr bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) - agi = bl->as_mob()->stats[mob_stat::AGI]; + agi = bl->is_mob()->stats[mob_stat::AGI]; else if (bl->bl_type == BL::PC) - agi = bl->as_player()->paramc[ATTR::AGI]; + agi = bl->is_player()->paramc[ATTR::AGI]; if (agi < 0) agi = 0; @@ -207,9 +207,9 @@ int battle_get_vit(dumb_ptr bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) - vit = bl->as_mob()->stats[mob_stat::VIT]; + vit = bl->is_mob()->stats[mob_stat::VIT]; else if (bl->bl_type == BL::PC) - vit = bl->as_player()->paramc[ATTR::VIT]; + vit = bl->is_player()->paramc[ATTR::VIT]; if (vit < 0) vit = 0; @@ -229,9 +229,9 @@ int battle_get_int(dumb_ptr bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) - int_ = bl->as_mob()->stats[mob_stat::INT]; + int_ = bl->is_mob()->stats[mob_stat::INT]; else if (bl->bl_type == BL::PC) - int_ = bl->as_player()->paramc[ATTR::INT]; + int_ = bl->is_player()->paramc[ATTR::INT]; if (int_ < 0) int_ = 0; @@ -251,9 +251,9 @@ int battle_get_dex(dumb_ptr bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) - dex = bl->as_mob()->stats[mob_stat::DEX]; + dex = bl->is_mob()->stats[mob_stat::DEX]; else if (bl->bl_type == BL::PC) - dex = bl->as_player()->paramc[ATTR::DEX]; + dex = bl->is_player()->paramc[ATTR::DEX]; if (dex < 0) dex = 0; @@ -273,9 +273,9 @@ int battle_get_luk(dumb_ptr bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) - luk = bl->as_mob()->stats[mob_stat::LUK]; + luk = bl->is_mob()->stats[mob_stat::LUK]; else if (bl->bl_type == BL::PC) - luk = bl->as_player()->paramc[ATTR::LUK]; + luk = bl->is_player()->paramc[ATTR::LUK]; if (luk < 0) luk = 0; @@ -296,7 +296,7 @@ int battle_get_flee(dumb_ptr bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) - flee = bl->as_player()->flee; + flee = bl->is_player()->flee; else flee = battle_get_agi(bl) + battle_get_lv(bl); @@ -325,7 +325,7 @@ int battle_get_hit(dumb_ptr bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) - hit = bl->as_player()->hit; + hit = bl->is_player()->hit; else hit = battle_get_dex(bl) + battle_get_lv(bl); @@ -354,7 +354,7 @@ int battle_get_flee2(dumb_ptr bl) sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) { - dumb_ptr sd = bl->as_player(); + dumb_ptr sd = bl->is_player(); flee2 = battle_get_luk(bl) + 10; flee2 += sd->flee2 - (sd->paramc[ATTR::LUK] + 10); } @@ -386,7 +386,7 @@ int battle_get_critical(dumb_ptr bl) sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) { - dumb_ptr sd = bl->as_player(); + dumb_ptr sd = bl->is_player(); critical = battle_get_luk(bl) * 2 + 10; critical += sd->critical - ((sd->paramc[ATTR::LUK] * 3) + 10); } @@ -412,7 +412,7 @@ int battle_get_baseatk(dumb_ptr bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) - batk = bl->as_player()->base_atk; //設定されているbase_atk + batk = bl->is_player()->base_atk; //設定されているbase_atk else { //それ以外なら int str, dstr; @@ -439,9 +439,9 @@ int battle_get_atk(dumb_ptr bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) - atk = bl->as_player()->watk; + atk = bl->is_player()->watk; else if (bl->bl_type == BL::MOB) - atk = bl->as_mob()->stats[mob_stat::ATK1]; + atk = bl->is_mob()->stats[mob_stat::ATK1]; if (atk < 0) atk = 0; @@ -458,7 +458,7 @@ int battle_get_atk_(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::PC) - return bl->as_player()->watk_; + return bl->is_player()->watk_; else return 0; } @@ -473,12 +473,12 @@ int battle_get_atk2(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::PC) - return bl->as_player()->watk2; + return bl->is_player()->watk2; else { int atk2 = 0; if (bl->bl_type == BL::MOB) - atk2 = bl->as_mob()->stats[mob_stat::ATK2]; + atk2 = bl->is_mob()->stats[mob_stat::ATK2]; if (atk2 < 0) atk2 = 0; @@ -496,7 +496,7 @@ int battle_get_atk_2(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::PC) - return bl->as_player()->watk_2; + return bl->is_player()->watk_2; else return 0; } @@ -520,7 +520,7 @@ int battle_get_matk1(dumb_ptr bl) return matk; } else if (bl->bl_type == BL::PC) - return bl->as_player()->matk1; + return bl->is_player()->matk1; else return 0; } @@ -542,7 +542,7 @@ int battle_get_matk2(dumb_ptr bl) return matk; } else if (bl->bl_type == BL::PC) - return bl->as_player()->matk2; + return bl->is_player()->matk2; else return 0; } @@ -561,11 +561,11 @@ int battle_get_def(dumb_ptr bl) sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) { - def = bl->as_player()->def; + def = bl->is_player()->def; } else if (bl->bl_type == BL::MOB) { - def = bl->as_mob()->stats[mob_stat::DEF]; + def = bl->is_mob()->stats[mob_stat::DEF]; } if (def < 1000000) @@ -596,9 +596,9 @@ int battle_get_mdef(dumb_ptr bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) - mdef = bl->as_player()->mdef; + mdef = bl->is_player()->mdef; else if (bl->bl_type == BL::MOB) - mdef = bl->as_mob()->stats[mob_stat::MDEF]; + mdef = bl->is_mob()->stats[mob_stat::MDEF]; if (mdef < 1000000) { @@ -631,9 +631,9 @@ int battle_get_def2(dumb_ptr bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) - def2 = bl->as_player()->def2; + def2 = bl->is_player()->def2; else if (bl->bl_type == BL::MOB) - def2 = bl->as_mob()->stats[mob_stat::VIT]; + def2 = bl->is_mob()->stats[mob_stat::VIT]; if (sc_data) { @@ -658,12 +658,12 @@ int battle_get_mdef2(dumb_ptr bl) nullpo_ret(bl); if (bl->bl_type == BL::MOB) { - dumb_ptr md = bl->as_mob(); + dumb_ptr md = bl->is_mob(); mdef2 = md->stats[mob_stat::INT] + (md->stats[mob_stat::VIT] >> 1); } else if (bl->bl_type == BL::PC) { - dumb_ptr sd = bl->as_player(); + dumb_ptr sd = bl->is_player(); mdef2 = sd->mdef2 + (sd->paramc[ATTR::VIT] >> 1); } @@ -682,12 +682,12 @@ interval_t battle_get_speed(dumb_ptr bl) { nullpo_retr(std::chrono::seconds(1), bl); if (bl->bl_type == BL::PC) - return bl->as_player()->speed; + return bl->is_player()->speed; else { interval_t speed = std::chrono::seconds(1); if (bl->bl_type == BL::MOB) - speed = static_cast(bl->as_mob()->stats[mob_stat::SPEED]); + speed = static_cast(bl->is_mob()->stats[mob_stat::SPEED]); return std::max(speed, std::chrono::milliseconds(1)); } @@ -703,14 +703,14 @@ interval_t battle_get_adelay(dumb_ptr bl) { nullpo_retr(std::chrono::seconds(4), bl); if (bl->bl_type == BL::PC) - return bl->as_player()->aspd * 2; + return bl->is_player()->aspd * 2; else { eptr sc_data = battle_get_sc_data(bl); interval_t adelay = std::chrono::seconds(4); int aspd_rate = 100; if (bl->bl_type == BL::MOB) - adelay = static_cast(bl->as_mob()->stats[mob_stat::ADELAY]); + adelay = static_cast(bl->is_mob()->stats[mob_stat::ADELAY]); if (sc_data) { @@ -731,14 +731,14 @@ interval_t battle_get_amotion(dumb_ptr bl) { nullpo_retr(std::chrono::seconds(2), bl); if (bl->bl_type == BL::PC) - return bl->as_player()->amotion; + return bl->is_player()->amotion; else { eptr sc_data = battle_get_sc_data(bl); interval_t amotion = std::chrono::seconds(2); int aspd_rate = 100; if (bl->bl_type == BL::MOB) - amotion = static_cast(mob_db[bl->as_mob()->mob_class].amotion); + amotion = static_cast(mob_db[bl->is_mob()->mob_class].amotion); if (sc_data) { @@ -759,11 +759,11 @@ interval_t battle_get_dmotion(dumb_ptr bl) nullpo_retr(interval_t::zero(), bl); if (bl->bl_type == BL::MOB) { - return static_cast(mob_db[bl->as_mob()->mob_class].dmotion); + return static_cast(mob_db[bl->is_mob()->mob_class].dmotion); } else if (bl->bl_type == BL::PC) { - return bl->as_player()->dmotion; + return bl->is_player()->dmotion; } else return std::chrono::seconds(2); @@ -775,7 +775,7 @@ LevelElement battle_get_element(dumb_ptr bl) nullpo_retr(ret, bl); if (bl->bl_type == BL::MOB) // 10の位=Lv*2、1の位=属性 - ret = bl->as_mob()->def_ele; + ret = bl->is_mob()->def_ele; return ret; } @@ -784,10 +784,10 @@ int battle_get_party_id(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::PC) - return bl->as_player()->status.party_id; + return bl->is_player()->status.party_id; else if (bl->bl_type == BL::MOB) { - dumb_ptr md = bl->as_mob(); + dumb_ptr md = bl->is_mob(); if (md->master_id > 0) return -md->master_id; return -md->bl_id; @@ -799,7 +799,7 @@ Race battle_get_race(dumb_ptr bl) { nullpo_retr(Race::formless, bl); if (bl->bl_type == BL::MOB) - return mob_db[bl->as_mob()->mob_class].race; + return mob_db[bl->is_mob()->mob_class].race; else if (bl->bl_type == BL::PC) return Race::demihuman; else @@ -810,7 +810,7 @@ MobMode battle_get_mode(dumb_ptr bl) { nullpo_retr(MobMode::CAN_MOVE, bl); if (bl->bl_type == BL::MOB) - return mob_db[bl->as_mob()->mob_class].mode; + return mob_db[bl->is_mob()->mob_class].mode; // とりあえず動くということで1 return MobMode::CAN_MOVE; } @@ -844,9 +844,9 @@ eptr battle_get_sc_data(dumb_ptr switch (bl->bl_type) { case BL::MOB: - return bl->as_mob()->sc_data; + return bl->is_mob()->sc_data; case BL::PC: - return bl->as_player()->sc_data; + return bl->is_player()->sc_data; } return nullptr; } @@ -855,9 +855,9 @@ short *battle_get_sc_count(dumb_ptr bl) { nullpo_retr(NULL, bl); if (bl->bl_type == BL::MOB) - return &bl->as_mob()->sc_count; + return &bl->is_mob()->sc_count; else if (bl->bl_type == BL::PC) - return &bl->as_player()->sc_count; + return &bl->is_player()->sc_count; return NULL; } @@ -865,11 +865,11 @@ Opt1 *battle_get_opt1(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return &bl->as_mob()->opt1; + return &bl->is_mob()->opt1; else if (bl->bl_type == BL::PC) - return &bl->as_player()->opt1; + return &bl->is_player()->opt1; else if (bl->bl_type == BL::NPC) - return &bl->as_npc()->opt1; + return &bl->is_npc()->opt1; return 0; } @@ -877,11 +877,11 @@ Opt2 *battle_get_opt2(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return &bl->as_mob()->opt2; + return &bl->is_mob()->opt2; else if (bl->bl_type == BL::PC) - return &bl->as_player()->opt2; + return &bl->is_player()->opt2; else if (bl->bl_type == BL::NPC) - return &bl->as_npc()->opt2; + return &bl->is_npc()->opt2; return 0; } @@ -889,11 +889,11 @@ Opt3 *battle_get_opt3(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return &bl->as_mob()->opt3; + return &bl->is_mob()->opt3; else if (bl->bl_type == BL::PC) - return &bl->as_player()->opt3; + return &bl->is_player()->opt3; else if (bl->bl_type == BL::NPC) - return &bl->as_npc()->opt3; + return &bl->is_npc()->opt3; return 0; } @@ -901,11 +901,11 @@ Option *battle_get_option(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return &bl->as_mob()->option; + return &bl->is_mob()->option; else if (bl->bl_type == BL::PC) - return &bl->as_player()->status.option; + return &bl->is_player()->status.option; else if (bl->bl_type == BL::NPC) - return &bl->as_npc()->option; + return &bl->is_npc()->option; return 0; } @@ -942,7 +942,7 @@ int battle_damage(dumb_ptr bl, dumb_ptr target, if (target->bl_type == BL::MOB) { // MOB - dumb_ptr md = target->as_mob(); + dumb_ptr md = target->is_mob(); if (md && md->skilltimer && md->state.skillcastcancel) // 詠唱妨害 skill_castcancel(target, 0); return mob_damage(bl, md, damage, 0); @@ -950,7 +950,7 @@ int battle_damage(dumb_ptr bl, dumb_ptr target, else if (target->bl_type == BL::PC) { // PC - dumb_ptr tsd = target->as_player(); + dumb_ptr tsd = target->is_player(); return pc_damage(bl, tsd, damage); @@ -964,7 +964,7 @@ int battle_heal(dumb_ptr bl, dumb_ptr target, int hp, nullpo_ret(target); //blはNULLで呼ばれることがあるので他でチェック if (target->bl_type == BL::PC - && pc_isdead(target->as_player())) + && pc_isdead(target->is_player())) return 0; if (hp == 0 && sp == 0) return 0; @@ -973,9 +973,9 @@ int battle_heal(dumb_ptr bl, dumb_ptr target, int hp, return battle_damage(bl, target, -hp, flag); if (target->bl_type == BL::MOB) - return mob_heal(target->as_mob(), hp); + return mob_heal(target->is_mob(), hp); else if (target->bl_type == BL::PC) - return pc_heal(target->as_player(), hp, sp); + return pc_heal(target->is_player(), hp, sp); return 0; } @@ -984,9 +984,9 @@ int battle_stopattack(dumb_ptr bl) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return mob_stopattack(bl->as_mob()); + return mob_stopattack(bl->is_mob()); else if (bl->bl_type == BL::PC) - return pc_stopattack(bl->as_player()); + return pc_stopattack(bl->is_player()); return 0; } @@ -995,9 +995,9 @@ int battle_stopwalking(dumb_ptr bl, int type) { nullpo_ret(bl); if (bl->bl_type == BL::MOB) - return mob_stop_walking(bl->as_mob(), type); + return mob_stop_walking(bl->is_mob(), type); else if (bl->bl_type == BL::PC) - return pc_stop_walking(bl->as_player(), type); + return pc_stop_walking(bl->is_player(), type); return 0; } @@ -1015,7 +1015,7 @@ int battle_calc_damage(dumb_ptr, dumb_ptr bl, nullpo_ret(bl); if (bl->bl_type == BL::MOB) - md = bl->as_mob(); + md = bl->is_mob(); if (battle_config.skill_min_damage || bool(flag & BF::MISC)) @@ -1042,7 +1042,7 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr src, int skill_lv, int) { dumb_ptr tsd = NULL; - dumb_ptr md = src->as_mob(), tmd = NULL; + dumb_ptr md = src->is_mob(), tmd = NULL; int hitrate, flee, cri = 0, atkmin, atkmax; int target_count = 1; int def1 = battle_get_def(target); @@ -1065,9 +1065,9 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr src, // ターゲット if (target->bl_type == BL::PC) - tsd = target->as_player(); + tsd = target->is_player(); else if (target->bl_type == BL::MOB) - tmd = target->as_mob(); + tmd = target->is_mob(); MobMode t_mode = battle_get_mode(target); t_sc_data = battle_get_sc_data(target); @@ -1295,7 +1295,7 @@ int battle_is_unarmed(dumb_ptr bl) return 0; if (bl->bl_type == BL::PC) { - dumb_ptr sd = bl->as_player(); + dumb_ptr sd = bl->is_player(); return (sd->equip_index[EQUIP::SHIELD] == -1 && sd->equip_index[EQUIP::WEAPON] == -1); @@ -1315,7 +1315,7 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr src, SkillID skill_num, int skill_lv, int) { - dumb_ptr sd = src->as_player(), tsd = NULL; + dumb_ptr sd = src->is_player(), tsd = NULL; dumb_ptr tmd = NULL; int hitrate, flee, cri = 0, atkmin, atkmax; int dex, target_count = 1; @@ -1346,9 +1346,9 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr src, // ターゲット if (target->bl_type == BL::PC) //対象がPCなら - tsd = target->as_player(); //tsdに代入(tmdはNULL) + tsd = target->is_player(); //tsdに代入(tmdはNULL) else if (target->bl_type == BL::MOB) //対象がMobなら - tmd = target->as_mob(); //tmdに代入(tsdはNULL) + tmd = target->is_mob(); //tmdに代入(tsdはNULL) MobMode t_mode = battle_get_mode(target); //対象のMode t_sc_data = battle_get_sc_data(target); //対象のステータス異常 @@ -1800,7 +1800,7 @@ struct Damage battle_calc_magic_attack(dumb_ptr bl, if (bl->bl_type == BL::PC) { - sd = bl->as_player(); + sd = bl->is_player(); sd->state.attack_type = BF::MAGIC; if (sd->matk_rate != 100) { @@ -1877,7 +1877,7 @@ struct Damage battle_calc_misc_attack(dumb_ptr bl, if (bl->bl_type == BL::PC) { - sd = bl->as_player(); + sd = bl->is_player(); sd->state.attack_type = BF::MISC; sd->state.arrow_atk = 0; } @@ -1967,14 +1967,14 @@ ATK battle_weapon_attack(dumb_ptr src, dumb_ptr target, nullpo_retr(ATK::ZERO, target); if (src->bl_type == BL::PC) - sd = src->as_player(); + sd = src->is_player(); if (src->bl_prev == NULL || target->bl_prev == NULL) return ATK::ZERO; if (src->bl_type == BL::PC && pc_isdead(sd)) return ATK::ZERO; if (target->bl_type == BL::PC - && pc_isdead(target->as_player())) + && pc_isdead(target->is_player())) return ATK::ZERO; Opt1 *opt1 = battle_get_opt1(src); @@ -2018,7 +2018,7 @@ ATK battle_weapon_attack(dumb_ptr src, dumb_ptr target, reduction = wd.damage; wd.damage -= reduction; - MAP_LOG_PC(target->as_player(), + MAP_LOG_PC(target->is_player(), "MAGIC-ABSORB-DMG %d", reduction); } @@ -2047,7 +2047,7 @@ ATK battle_weapon_attack(dumb_ptr src, dumb_ptr target, sd->status.char_id, src->bl_m->name_, src->bl_x, src->bl_y, (target->bl_type == BL::PC) ? "PC" : "MOB", (target->bl_type == BL::PC) - ? target->as_player()-> status.char_id + ? target->is_player()-> status.char_id : target->bl_id, battle_get_class(target), wd.damage + wd.damage2, weapon); @@ -2055,12 +2055,12 @@ ATK battle_weapon_attack(dumb_ptr src, dumb_ptr target, if (target->bl_type == BL::PC) { - dumb_ptr sd2 = target->as_player(); + dumb_ptr sd2 = target->is_player(); MAP_LOG("PC%d %s:%d,%d WPNINJURY %s%d %d FOR %d", sd2->status.char_id, target->bl_m->name_, target->bl_x, target->bl_y, (src->bl_type == BL::PC) ? "PC" : "MOB", (src->bl_type == BL::PC) - ? src->as_player()->status.char_id + ? src->is_player()->status.char_id : src->bl_id, battle_get_class(src), wd.damage + wd.damage2); @@ -2070,7 +2070,7 @@ ATK battle_weapon_attack(dumb_ptr src, dumb_ptr target, if (target->bl_prev != NULL && (target->bl_type != BL::PC || (target->bl_type == BL::PC - && !pc_isdead(target->as_player())))) + && !pc_isdead(target->is_player())))) { if (wd.damage > 0 || wd.damage2 > 0) { @@ -2163,13 +2163,13 @@ int battle_check_target(dumb_ptr src, dumb_ptr target, } if (target->bl_type == BL::PC - && target->as_player()->invincible_timer) + && target->is_player()->invincible_timer) return -1; // Mobでmaster_idがあってspecial_mob_aiなら、召喚主を求める if (src->bl_type == BL::MOB) { - dumb_ptr md = src->as_mob(); + dumb_ptr md = src->is_mob(); if (md && md->master_id > 0) { if (md->master_id == target->bl_id) // 主なら肯定 @@ -2178,7 +2178,7 @@ int battle_check_target(dumb_ptr src, dumb_ptr target, { if (target->bl_type == BL::MOB) { //special_mob_aiで対象がMob - dumb_ptr tmd = target->as_mob(); + dumb_ptr tmd = target->is_mob(); if (tmd) { if (tmd->master_id != md->master_id) //召喚主が一緒でなければ否定 @@ -2202,11 +2202,11 @@ int battle_check_target(dumb_ptr src, dumb_ptr target, return 1; if (target->bl_type == BL::PC - && pc_isinvisible(target->as_player())) + && pc_isinvisible(target->is_player())) return -1; if (src->bl_prev == NULL || // 死んでるならエラー - (src->bl_type == BL::PC && pc_isdead(src->as_player()))) + (src->bl_type == BL::PC && pc_isdead(src->is_player()))) return -1; if ((ss->bl_type == BL::PC && target->bl_type == BL::MOB) || @@ -2231,7 +2231,7 @@ int battle_check_target(dumb_ptr src, dumb_ptr target, if (ss->bl_type == BL::PC && target->bl_type == BL::PC) { // 両方PVPモードなら否定(敵) if (ss->bl_m->flag.pvp - || pc_iskiller(ss->as_player(), target->as_player())) + || pc_iskiller(ss->is_player(), target->is_player())) { // [MouseJstr] if (battle_config.pk_mode) return 1; // prevent novice engagement in pk_mode [Valaris] -- cgit v1.2.3-70-g09d2