diff options
Diffstat (limited to 'src/map/pc.cpp')
-rw-r--r-- | src/map/pc.cpp | 70 |
1 files changed, 47 insertions, 23 deletions
diff --git a/src/map/pc.cpp b/src/map/pc.cpp index a38c05f..33d77fd 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -555,14 +555,22 @@ int pc_setequipindex(dumb_ptr<map_session_data> sd) sd->equip_index_maybe[j] = i; if (bool(sd->status.inventory[i].equip & EPOS::WEAPON)) { - if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[i]) - sd->weapontype1 = sdidi->look; - else - sd->weapontype1 = ItemLook::NONE; + OMATCH_BEGIN (sd->inventory_data[i]) + { + OMATCH_CASE_SOME (sdidi) + { + sd->weapontype1 = sdidi->look; + } + OMATCH_CASE_NONE () + { + sd->weapontype1 = ItemLook::NONE; + } + } + OMATCH_END (); } if (bool(sd->status.inventory[i].equip & EPOS::SHIELD)) { - if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[i]) + OMATCH_BEGIN_SOME (sdidi, sd->inventory_data[i]) { if (sdidi->type == ItemType::WEAPON) { @@ -570,6 +578,7 @@ int pc_setequipindex(dumb_ptr<map_session_data> sd) assert(0 && "unreachable - offhand weapons are not supported"); } } + OMATCH_END (); } } } @@ -998,13 +1007,14 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) || sd->equip_index_maybe[EQUIP::LEGS] == index)) continue; - if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[index]) + OMATCH_BEGIN_SOME (sdidi, sd->inventory_data[index]) { sd->spellpower_bonus_target += sdidi->magic_bonus; // used to apply cards } + OMATCH_END (); } #ifdef USE_ASTRAL_SOUL_SKILL @@ -1033,7 +1043,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) && (sd->equip_index_maybe[EQUIP::TORSO] == index || sd->equip_index_maybe[EQUIP::LEGS] == index)) continue; - if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[index]) + OMATCH_BEGIN_SOME (sdidi, sd->inventory_data[index]) { sd->def += sdidi->def; if (sdidi->type == ItemType::WEAPON) @@ -1072,6 +1082,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) arg); } } + OMATCH_END (); } if (battle_is_unarmed(sd)) @@ -1084,7 +1095,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) if (aidx.ok()) { IOff0 index = aidx; - if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[index]) + OMATCH_BEGIN_SOME (sdidi, sd->inventory_data[index]) { //まだ属性が入っていない argrec_t arg[2] = { @@ -1098,6 +1109,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) sd->state.lr_flag_is_arrow_2 = 0; sd->arrow_atk += sdidi->atk; } + OMATCH_END (); } sd->def += (refinedef + 50) / 100; @@ -2111,7 +2123,7 @@ int pc_useitem(dumb_ptr<map_session_data> sd, IOff0 n) if (!n.ok()) return 0; - if OPTION_IS_SOME_NOLOOP(sdidn, sd->inventory_data[n]) + OMATCH_BEGIN_SOME (sdidn, sd->inventory_data[n]) { amount = sd->status.inventory[n].amount; if (!sd->status.inventory[n].nameid @@ -2128,6 +2140,7 @@ int pc_useitem(dumb_ptr<map_session_data> sd, IOff0 n) run_script(ScriptPointer(script, 0), sd->bl_id, BlockId()); } + OMATCH_END (); return 0; } @@ -3172,8 +3185,11 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd, if (sd->status.party_id) { // on-the-fly party hp updates [Valaris] Option<PartyPair> p_ = party_search(sd->status.party_id); - if OPTION_IS_SOME_NOLOOP(p, p_) + OMATCH_BEGIN_SOME (p, p_) + { clif_party_hp(p, sd); + } + OMATCH_END (); } // end addition [Valaris] return 0; @@ -3540,8 +3556,11 @@ int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp) if (sd->status.party_id) { // on-the-fly party hp updates [Valaris] Option<PartyPair> p_ = party_search(sd->status.party_id); - if OPTION_IS_SOME_NOLOOP(p, p_) + OMATCH_BEGIN_SOME (p, p_) + { clif_party_hp(p, sd); + } + OMATCH_END (); } // end addition [Valaris] return hp + sp; @@ -4191,7 +4210,7 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, IOff0 n, EPOS) ItemNameId view_i; ItemLook view_l = ItemLook::NONE; // TODO: This is ugly. - if OPTION_IS_SOME_NOLOOP(sdidn, sd->inventory_data[n]) + OMATCH_BEGIN_SOME (sdidn, sd->inventory_data[n]) { bool look_not_weapon = sdidn->look == ItemLook::NONE; bool equip_is_weapon = bool(sd->status.inventory[n].equip & EPOS::WEAPON); @@ -4202,6 +4221,7 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, IOff0 n, EPOS) else view_l = sdidn->look; } + OMATCH_END (); if (bool(sd->status.inventory[n].equip & EPOS::WEAPON)) { @@ -4211,23 +4231,27 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, IOff0 n, EPOS) } if (bool(sd->status.inventory[n].equip & EPOS::SHIELD)) { - if OPTION_IS_SOME_NOLOOP(sdidn, sd->inventory_data[n]) + OMATCH_BEGIN (sd->inventory_data[n]) { - if (sdidn->type == ItemType::WEAPON) + OMATCH_CASE_SOME (sdidn) { - sd->status.shield = ItemNameId(); - if (sd->status.inventory[n].equip == EPOS::SHIELD) - assert(0 && "unreachable - offhand weapons are not supported"); + if (sdidn->type == ItemType::WEAPON) + { + sd->status.shield = ItemNameId(); + if (sd->status.inventory[n].equip == EPOS::SHIELD) + assert(0 && "unreachable - offhand weapons are not supported"); + } + else if (sdidn->type == ItemType::ARMOR) + { + sd->status.shield = view_i; + } } - else if (sdidn->type == ItemType::ARMOR) + OMATCH_CASE_NONE () { - sd->status.shield = view_i; + sd->status.shield = ItemNameId(); } } - else - { - sd->status.shield = ItemNameId(); - } + OMATCH_END (); pc_calcweapontype(sd); clif_changelook(sd, LOOK::SHIELD, unwrap<ItemNameId>(sd->status.shield)); } |