diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.cpp | 3 | ||||
-rw-r--r-- | src/map/battle.cpp | 172 | ||||
-rw-r--r-- | src/map/battle.hpp | 2 | ||||
-rw-r--r-- | src/map/clif.cpp | 5 | ||||
-rw-r--r-- | src/map/clif.hpp | 4 | ||||
-rw-r--r-- | src/map/magic-stmt.cpp | 2 | ||||
-rw-r--r-- | src/map/map.hpp | 15 | ||||
-rw-r--r-- | src/map/pc.cpp | 264 | ||||
-rw-r--r-- | src/map/script.cpp | 1 | ||||
-rw-r--r-- | src/map/skill.cpp | 14 |
10 files changed, 92 insertions, 390 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 8f103e1..69e4b78 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -1312,7 +1312,7 @@ ATCE atcommand_heal(Session *s, dumb_ptr<map_session_data> sd, if (hp < 0) // display like damage - clif_damage(sd, sd, gettick(), interval_t::zero(), interval_t::zero(), -hp, 0, DamageType::RETURNED, 0); + clif_damage(sd, sd, gettick(), interval_t::zero(), interval_t::zero(), -hp, 0, DamageType::RETURNED); if (hp != 0 || sp != 0) { @@ -1621,7 +1621,6 @@ ATCE atcommand_pvpon(Session *s, dumb_ptr<map_session_data> sd, pl_sd->pvp_timer = Timer(gettick() + 200_ms, std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, pl_sd->bl_id)); pl_sd->pvp_rank = 0; - pl_sd->pvp_lastusers = 0; pl_sd->pvp_point = 5; } } diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 5e81184..07210fd 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -482,21 +482,6 @@ int battle_get_atk(dumb_ptr<block_list> bl) } /*========================================== - * 対象の左手Atkを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -static -int battle_get_atk_(dumb_ptr<block_list> bl) -{ - nullpo_retz(bl); - if (bl->bl_type == BL::PC) - return bl->is_player()->watk_; - else - return 0; -} - -/*========================================== * 対象のAtk2を返す(汎用) * 戻りは整数で0以上 *------------------------------------------ @@ -520,21 +505,6 @@ int battle_get_atk2(dumb_ptr<block_list> bl) } /*========================================== - * 対象の左手Atk2を返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -static -int battle_get_atk_2(dumb_ptr<block_list> bl) -{ - nullpo_retz(bl); - if (bl->bl_type == BL::PC) - return bl->is_player()->watk_2; - else - return 0; -} - -/*========================================== * 対象のMAtk1を返す(汎用) * 戻りは整数で0以上 *------------------------------------------ @@ -1082,7 +1052,7 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr<block_list> src, int def2 = battle_get_def2(target); int t_vit = battle_get_vit(target); struct Damage wd {}; - int damage, damage2 = 0; + int damage; DamageType type; int div_; BF flag; @@ -1273,7 +1243,7 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr<block_list> src, if (type == DamageType::NORMAL && !random_::chance({hitrate, 100})) { - damage = damage2 = 0; + damage = 0; dmg_lv = ATK::FLEE; } else @@ -1312,7 +1282,6 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr<block_list> src, skill_num, skill_lv, flag); wd.damage = damage; - wd.damage2 = 0; wd.type = type; wd.div_ = div_; wd.amotion = battle_get_amotion(src); @@ -1357,14 +1326,13 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, int def2 = battle_get_def2(target); int t_vit = battle_get_vit(target); struct Damage wd {}; - int damage, damage2; + int damage; DamageType type; int div_; BF flag; ATK dmg_lv = ATK::ZERO; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data, t_sc_data; - int atkmax_ = 0, atkmin_ = 0; //二刀流用 - int watk, watk_; + int watk; bool da = false; int ac_flag = 0; int target_distance; @@ -1428,13 +1396,12 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, dex = battle_get_dex(src); //DEX watk = battle_get_atk(src); //ATK - watk_ = battle_get_atk_(src); //ATK左手 type = DamageType::NORMAL; div_ = 1; // single attack { - damage = damage2 = battle_get_baseatk(sd); //damega,damega2初登場、base_atkの取得 + damage = battle_get_baseatk(sd); //damega,damega2初登場、base_atkの取得 } if (sd->attackrange > 2) { // [fate] ranged weapon? @@ -1443,22 +1410,15 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, damage * (256 + ((range_damage_bonus * target_distance) / sd->attackrange)) >> 8; - damage2 = - damage2 * (256 + - ((range_damage_bonus * target_distance) / - sd->attackrange)) >> 8; } - atkmin = atkmin_ = dex; //最低ATKはDEXで初期化? + atkmin = dex; //最低ATKはDEXで初期化? sd->state.arrow_atk = 0; //arrow_atk初期化 IOff0 widx = sd->equip_index_maybe[EQUIP::WEAPON]; - IOff0 sidx = sd->equip_index_maybe[EQUIP::SHIELD]; if (widx.ok() && sd->inventory_data[widx]) atkmin = atkmin * (80 + sd->inventory_data[widx]->wlv * 20) / 100; - if (sidx.ok() && sd->inventory_data[sidx]) - atkmin_ = atkmin_ * (80 + sd->inventory_data[sidx]->wlv * 20) / 100; if (sd->status.weapon == ItemLook::BOW) { //武器が弓矢の場合 atkmin = watk * ((atkmin < watk) ? atkmin : watk) / 100; //弓用最低ATK計算 @@ -1468,13 +1428,10 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, { atkmax = watk; - atkmax_ = watk_; } if (atkmin > atkmax && !(sd->state.arrow_atk)) atkmin = atkmax; //弓は最低が上回る場合あり - if (atkmin_ > atkmax_) - atkmin_ = atkmax_; if (sd->double_rate > 0 && skill_num == SkillID::ZERO && skill_lv >= 0) da = random_::chance({sd->double_rate, 100}); @@ -1486,9 +1443,6 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, if (sd->state.arrow_atk) cri += sd->arrow_cri; - if (sd->status.weapon == ItemLook::_16) - // カタールの場合、クリティカルを倍に - cri <<= 1; cri -= battle_get_luk(target) * 3; if (ac_flag) cri = 1000; @@ -1503,11 +1457,9 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, && random_::chance({cri, 1000})) { damage += atkmax; - damage2 += atkmax_; if (sd->atk_rate != 100) { damage = (damage * sd->atk_rate) / 100; - damage2 = (damage2 * sd->atk_rate) / 100; } if (sd->state.arrow_atk) damage += sd->arrow_atk; @@ -1521,14 +1473,9 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, damage += random_::in(atkmin, atkmax); else damage += atkmin; - if (atkmax_ > atkmin_) - damage2 += random_::in(atkmin_, atkmax_); - else - damage2 += atkmin_; if (sd->atk_rate != 100) { damage = (damage * sd->atk_rate) / 100; - damage2 = (damage2 * sd->atk_rate) / 100; } if (sd->state.arrow_atk) @@ -1614,28 +1561,17 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, damage -= random_::in(0, vitbonusmax); } } - { - { - damage2 = damage2 * (100 - def1) / 100; - damage2 -= t_def; - if (vitbonusmax > 0) - damage2 -= random_::in(0, vitbonusmax); - } - } } } } // 精錬ダメージの追加 { //DEF, VIT無視 damage += battle_get_atk2(src); - damage2 += battle_get_atk_2(src); } // 0未満だった場合1に補正 if (damage < 1) damage = 1; - if (damage2 < 1) - damage2 = 1; // スキル修正2(修練系) // 修練ダメージ(右手のみ) ソニックブロー時は別処理(1撃に付き1/8適応) @@ -1652,7 +1588,7 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, hitrate = (hitrate < 5) ? 5 : hitrate; if (type == DamageType::NORMAL && !random_::chance({hitrate, 100})) { - damage = damage2 = 0; + damage = 0; dmg_lv = ATK::FLEE; } else @@ -1662,37 +1598,6 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, if (damage < 0) damage = 0; - if (damage2 < 0) - damage2 = 0; - - // >二刀流の左右ダメージ計算誰かやってくれぇぇぇぇえええ! - // >map_session_data に左手ダメージ(atk,atk2)追加して - // >pc_calcstatus()でやるべきかな? - // map_session_data に左手武器(atk,atk2,ele,star,atkmods)追加して - // pc_calcstatus()でデータを入力しています - - //左手のみ武器装備 - if (sd->weapontype1 == ItemLook::NONE - && sd->weapontype2 != ItemLook::NONE) - { - damage = damage2; - damage2 = 0; - } - // 右手、左手修練の適用 - if (sd->status.weapon >= ItemLook::SINGLE_HANDED_COUNT) - { // 二刀流か? - int dmg = damage, dmg2 = damage2; - // 右手修練(60% 〜 100%) 右手全般 - damage = damage * 50 / 100; - if (dmg > 0 && damage < 1) - damage = 1; - // 左手修練(40% 〜 80%) 左手全般 - damage2 = damage2 * 30 / 100; - if (dmg2 > 0 && damage2 < 1) - damage2 = 1; - } - else //二刀流でなければ左手ダメージは0 - damage2 = 0; // 右手,短剣のみ if (da) @@ -1702,19 +1607,11 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, type = DamageType::DOUBLED; } - if (sd->status.weapon == ItemLook::_16) - { - // カタール追撃ダメージ - damage2 = damage * 1 / 100; - if (damage > 0 && damage2 < 1) - damage2 = 1; - } - // 完全回避の判定 if (skill_num == SkillID::ZERO && skill_lv >= 0 && tsd != nullptr && div_ < 255 && random_::chance({battle_get_flee2(target), 1000})) { - damage = damage2 = 0; + damage = 0; type = DamageType::FLEE2; dmg_lv = ATK::LUCKY; } @@ -1725,7 +1622,7 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, if (skill_num == SkillID::ZERO && skill_lv >= 0 && tmd != nullptr && div_ < 255 && random_::chance({battle_get_flee2(target), 1000})) { - damage = damage2 = 0; + damage = 0; type = DamageType::FLEE2; dmg_lv = ATK::LUCKY; } @@ -1736,35 +1633,18 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, { if (damage > 0) damage = 1; - if (damage2 > 0) - damage2 = 1; } - if (damage > 0 || damage2 > 0) + if (damage > 0) { - if (damage2 < 1) // ダメージ最終修正 + { damage = battle_calc_damage(src, target, damage, div_, skill_num, skill_lv, flag); - else if (damage < 1) // 右手がミス? - damage2 = - battle_calc_damage(src, target, damage2, div_, skill_num, - skill_lv, flag); - else - { // 両 手/カタールの場合はちょっと計算ややこしい - int d1 = damage + damage2, d2 = damage2; - damage = - battle_calc_damage(src, target, damage + damage2, div_, - skill_num, skill_lv, flag); - damage2 = (d2 * 100 / d1) * damage / 100; - if (damage > 1 && damage2 < 1) - damage2 = 1; - damage -= damage2; } } wd.damage = damage; - wd.damage2 = damage2; wd.type = type; wd.div_ = div_; wd.amotion = battle_get_amotion(src); @@ -1872,7 +1752,6 @@ struct Damage battle_calc_magic_attack(dumb_ptr<block_list> bl, md.div_ = div_; md.amotion = battle_get_amotion(bl); md.dmotion = battle_get_dmotion(target); - md.damage2 = 0; md.type = DamageType::NORMAL; md.flag = aflag; @@ -1937,7 +1816,6 @@ struct Damage battle_calc_misc_attack(dumb_ptr<block_list> bl, md.div_ = div_; md.amotion = battle_get_amotion(bl); md.dmotion = battle_get_dmotion(target); - md.damage2 = 0; md.type = DamageType::NORMAL; md.flag = aflag; return md; @@ -2048,13 +1926,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, { clif_damage(src, target, tick, wd.amotion, wd.dmotion, - wd.damage, wd.div_, wd.type, wd.damage2); - if (sd - && (sd->status.weapon == ItemLook::_16 - || sd->status.weapon >= ItemLook::SINGLE_HANDED_COUNT) - && wd.damage2 == 0) - clif_damage(src, target, tick + 10_ms, - wd.amotion, wd.dmotion, 0, 1, DamageType::NORMAL, 0); + wd.damage, wd.div_, wd.type); } MapBlockLock lock; @@ -2074,7 +1946,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, ? unwrap<CharId>(target->is_player()->status_key.char_id) : unwrap<BlockId>(target->bl_id), battle_get_class(target), - wd.damage + wd.damage2, weapon); + wd.damage, weapon); } if (target->bl_type == BL::PC) @@ -2087,16 +1959,16 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, ? unwrap<CharId>(src->is_player()->status_key.char_id) : unwrap<BlockId>(src->bl_id), battle_get_class(src), - wd.damage + wd.damage2); + wd.damage); } - battle_damage(src, target, (wd.damage + wd.damage2), 0); + battle_damage(src, target, (wd.damage), 0); if (target->bl_prev != nullptr && (target->bl_type != BL::PC || (target->bl_type == BL::PC && !pc_isdead(target->is_player())))) { - if (wd.damage > 0 || wd.damage2 > 0) + if (wd.damage > 0) { skill_additional_effect(src, target, SkillID::ZERO, 0); } @@ -2105,7 +1977,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, { if (bool(wd.flag & BF::WEAPON) && src != target - && (wd.damage > 0 || wd.damage2 > 0)) + && (wd.damage > 0)) { int hp = 0, sp = 0; if (sd->hp_drain_rate && wd.damage > 0 @@ -2113,21 +1985,11 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, { hp += (wd.damage * sd->hp_drain_per) / 100; } - if (sd->hp_drain_rate_ && wd.damage2 > 0 - && random_::chance({sd->hp_drain_rate_, 100})) - { - hp += (wd.damage2 * sd->hp_drain_per_) / 100; - } if (sd->sp_drain_rate && wd.damage > 0 && random_::chance({sd->sp_drain_rate, 100})) { sp += (wd.damage * sd->sp_drain_per) / 100; } - if (sd->sp_drain_rate_ && wd.damage2 > 0 - && random_::chance({sd->sp_drain_rate_, 100})) - { - sp += (wd.damage2 * sd->sp_drain_per_) / 100; - } if (hp || sp) pc_heal(sd, hp, sp); } diff --git a/src/map/battle.hpp b/src/map/battle.hpp index b6aeff5..83d94fc 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -40,7 +40,7 @@ namespace tmwa // ダメージ struct Damage { - int damage, damage2; + int damage; DamageType type; int div_; interval_t amotion, dmotion; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 025b8e8..1b0358b 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -2468,7 +2468,7 @@ int clif_fixpcpos(dumb_ptr<map_session_data> sd) */ int clif_damage(dumb_ptr<block_list> src, dumb_ptr<block_list> dst, tick_t tick, interval_t sdelay, interval_t ddelay, int damage, - int div, DamageType type, int damage2) + int div, DamageType type) { eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; @@ -2486,7 +2486,7 @@ int clif_damage(dumb_ptr<block_list> src, dumb_ptr<block_list> dst, fixed_8a.damage = (damage > 0x7fff) ? 0x7fff : damage; fixed_8a.div = div; fixed_8a.damage_type = type; - fixed_8a.damage2 = damage2; + fixed_8a.damage2 = 0; Buffer buf = create_fpacket<0x008a, 29>(fixed_8a); clif_send(buf, src, SendWho::AREA); @@ -3465,7 +3465,6 @@ RecvResult clif_parse_LoadEndAck(Session *s, dumb_ptr<map_session_data> sd) std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, sd->bl_id)); sd->pvp_rank = 0; - sd->pvp_lastusers = 0; sd->pvp_point = 5; } } diff --git a/src/map/clif.hpp b/src/map/clif.hpp index adb4889..ae23b7b 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -87,11 +87,11 @@ void clif_delitem(dumb_ptr<map_session_data>, IOff0, int); //self int clif_updatestatus(dumb_ptr<map_session_data>, SP); //self int clif_damage(dumb_ptr<block_list>, dumb_ptr<block_list>, tick_t, interval_t, interval_t, - int, int, DamageType, int); // area + int, int, DamageType); // area inline int clif_takeitem(dumb_ptr<block_list> src, dumb_ptr<block_list> dst) { - return clif_damage(src, dst, tick_t(), interval_t::zero(), interval_t::zero(), 0, 0, DamageType::TAKEITEM, 0); + return clif_damage(src, dst, tick_t(), interval_t::zero(), interval_t::zero(), 0, 0, DamageType::TAKEITEM); } int clif_changelook(dumb_ptr<block_list>, LOOK, int); // area void clif_changelook_accessories(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> dst); // area or target; list gloves, boots etc. diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp index 2a657fa..1786839 100644 --- a/src/map/magic-stmt.cpp +++ b/src/map/magic-stmt.cpp @@ -786,7 +786,7 @@ int op_injure(dumb_ptr<env_t> env, Slice<val_t> args) // display damage first, because dealing damage may deallocate the target. clif_damage(caster, target, gettick(), interval_t::zero(), interval_t::zero(), - damage_caused, 0, DamageType::NORMAL, 0); + damage_caused, 0, DamageType::NORMAL); if (caster->bl_type == BL::PC) { diff --git a/src/map/map.hpp b/src/map/map.hpp index 8c2181c..a87c0fe 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -156,7 +156,7 @@ struct map_session_data : block_list, SessionData unsigned dead_sit:2; unsigned skillcastcancel:1; unsigned waitingdisconnect:1; - unsigned lr_flag:2; + unsigned lr_flag_is_arrow_2:1; unsigned connect_new:1; unsigned arrow_atk:1; BF attack_type;//:3; @@ -235,7 +235,7 @@ struct map_session_data : block_list, SessionData short spellpower_bonus_target, spellpower_bonus_current; // [Fate] Spellpower boni. _current is the active one. //_current slowly approximates _target, and _target is determined by equipment. - short attackrange, attackrange_; + short attackrange; // [Fate] Used for gradual healing; amount of enqueued regeneration struct quick_regeneration quick_regeneration_hp, quick_regeneration_sp; @@ -249,18 +249,17 @@ struct map_session_data : block_list, SessionData interval_t hp_sub, sp_sub; interval_t inchealhptick, inchealsptick; - ItemLook weapontype1, weapontype2; + ItemLook weapontype1; earray<int, ATTR, ATTR::COUNT> paramb, paramc, parame, paramcard; int hit, flee, flee2; interval_t aspd, amotion, dmotion; int watk, watk2; int def, def2, mdef, mdef2, critical, matk1, matk2; int hprate, sprate, dsprate; - int watk_, watk_2; int base_atk, atk_rate; int arrow_atk; int arrow_cri, arrow_hit, arrow_range; - int nhealhp, nhealsp, nshealhp, nshealsp, nsshealhp, nsshealsp; + int nhealhp, nhealsp; int aspd_rate, speed_rate, hprecov_rate, sprecov_rate, critical_def, double_rate; int matk_rate; @@ -269,9 +268,6 @@ struct map_session_data : block_list, SessionData mdef_rate, mdef2_rate; int double_add_rate, speed_add_rate, aspd_add_rate, perfect_hit_add; short hp_drain_rate, hp_drain_per, sp_drain_rate, sp_drain_per; - short hp_drain_rate_, hp_drain_per_, sp_drain_rate_, sp_drain_per_; - short break_weapon_rate, break_armor_rate; - short add_steal_rate; int die_counter; @@ -298,11 +294,8 @@ struct map_session_data : block_list, SessionData PartyId partyspy; // [Syrus22] - int catch_target_class; - int pvp_point, pvp_rank; Timer pvp_timer; - int pvp_lastusers; std::list<NpcEvent> eventqueuel; Array<Timer, MAX_EVENTTIMER> eventtimer; diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 17f0cf1..7f4c367 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -120,7 +120,7 @@ int sp_coefficient_0 = 100; // coefficients for each weapon type // (not all used) static //const -earray<interval_t, ItemLook, ItemLook::SINGLE_HANDED_COUNT> aspd_base_0 //= +earray<interval_t, ItemLook, ItemLook::COUNT> aspd_base_0 //= {{ 650_ms, 700_ms, @@ -531,40 +531,8 @@ int pc_calcweapontype(dumb_ptr<map_session_data> sd) { nullpo_retz(sd); - if (sd->weapontype1 != ItemLook::NONE - && sd->weapontype2 == ItemLook::NONE) - sd->status.weapon = sd->weapontype1; - if (sd->weapontype1 == ItemLook::NONE - && sd->weapontype2 != ItemLook::NONE) - sd->status.weapon = sd->weapontype2; - else if (sd->weapontype1 == ItemLook::BLADE - && sd->weapontype2 == ItemLook::BLADE) - sd->status.weapon = ItemLook::DUAL_BLADE; - else if (sd->weapontype1 == ItemLook::_2 - && sd->weapontype2 == ItemLook::_2) - sd->status.weapon = ItemLook::DUAL_2; - else if (sd->weapontype1 == ItemLook::_6 - && sd->weapontype2 == ItemLook::_6) - sd->status.weapon = ItemLook::DUAL_6; - else if ((sd->weapontype1 == ItemLook::BLADE - && sd->weapontype2 == ItemLook::_2) - || (sd->weapontype1 == ItemLook::_2 - && sd->weapontype2 == ItemLook::BLADE)) - sd->status.weapon = ItemLook::DUAL_12; - else if ( - (sd->weapontype1 == ItemLook::BLADE - && sd->weapontype2 == ItemLook::_6) - || (sd->weapontype1 == ItemLook::_6 - && sd->weapontype2 == ItemLook::BLADE)) - sd->status.weapon = ItemLook::DUAL_16; - else if ( - (sd->weapontype1 == ItemLook::_2 - && sd->weapontype2 == ItemLook::_6) - || (sd->weapontype1 == ItemLook::_6 - && sd->weapontype2 == ItemLook::_2)) - sd->status.weapon = ItemLook::DUAL_26; - else - sd->status.weapon = sd->weapontype1; + // TODO now that there is no calculation here, store only once + sd->status.weapon = sd->weapontype1; return 0; } @@ -600,15 +568,9 @@ int pc_setequipindex(dumb_ptr<map_session_data> sd) if (sd->inventory_data[i]->type == ItemType::WEAPON) { if (sd->status.inventory[i].equip == EPOS::SHIELD) - sd->weapontype2 = sd->inventory_data[i]->look; - else - sd->weapontype2 = ItemLook::NONE; + assert(0 && "unreachable - offhand weapons are not supported"); } - else - sd->weapontype2 = ItemLook::NONE; } - else - sd->weapontype2 = ItemLook::NONE; } } } @@ -681,7 +643,7 @@ int pc_authok(AccountId id, int login_id2, TimeT connect_until_time, sd->state.connect_new = 1; sd->bl_prev = sd->bl_next = nullptr; - sd->weapontype1 = sd->weapontype2 = ItemLook::NONE; + sd->weapontype1 = ItemLook::NONE; sd->speed = DEFAULT_WALK_SPEED; sd->state.dead_sit = 0; sd->dir = DIR::S; @@ -1005,7 +967,6 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) sd->status.max_hp = 0; sd->status.max_sp = 0; sd->attackrange = 0; - sd->attackrange_ = 0; sd->matk1 = 0; sd->matk2 = 0; sd->speed = DEFAULT_WALK_SPEED; @@ -1016,13 +977,9 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) sd->arrow_atk = 0; sd->arrow_hit = 0; sd->arrow_range = 0; - sd->nhealhp = sd->nhealsp = sd->nshealhp = sd->nshealsp = sd->nsshealhp = - sd->nsshealsp = 0; + sd->nhealhp = sd->nhealsp = 0; really_memzero_this(&sd->special_state); - sd->watk_ = 0; //二刀流用(仮) - sd->watk_2 = 0; - sd->aspd_rate = 100; sd->speed_rate = 100; sd->hprecov_rate = 100; @@ -1038,8 +995,6 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) sd->double_add_rate = sd->perfect_hit_add = 0; sd->hp_drain_rate = sd->hp_drain_per = sd->sp_drain_rate = sd->sp_drain_per = 0; - sd->hp_drain_rate_ = sd->hp_drain_per_ = sd->sp_drain_rate_ = - sd->sp_drain_per_ = 0; sd->spellpower_bonus_target = 0; @@ -1100,23 +1055,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) if (i == EQUIP::SHIELD && sd->status.inventory[index].equip == EPOS::SHIELD) { - //二刀流用データ入力 - sd->watk_ += sd->inventory_data[index]->atk; - sd->watk_2 = 0; - - sd->attackrange_ += sd->inventory_data[index]->range; - sd->state.lr_flag = 1; - { - argrec_t arg[2] = - { - {"@slotId"_s, static_cast<int>(i)}, - {"@itemId"_s, unwrap<ItemNameId>(sd->inventory_data[index]->nameid)}, - }; - run_script_l(ScriptPointer(sd->inventory_data[index]->equip_script.get(), 0), - sd->bl_id, BlockId(), - arg); - } - sd->state.lr_flag = 0; + assert(0 && "unreachable - offhand weapons are not supported"); } else { @@ -1153,8 +1092,6 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) { sd->watk += skill_power(sd, SkillID::TMW_BRAWLING) / 3; // +66 for 200 sd->watk2 += skill_power(sd, SkillID::TMW_BRAWLING) >> 3; // +25 for 200 - sd->watk_ += skill_power(sd, SkillID::TMW_BRAWLING) / 3; // +66 for 200 - sd->watk_2 += skill_power(sd, SkillID::TMW_BRAWLING) >> 3; // +25 for 200 } IOff0 aidx = sd->equip_index_maybe[EQUIP::ARROW]; @@ -1168,11 +1105,11 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) {"@slotId"_s, static_cast<int>(EQUIP::ARROW)}, {"@itemId"_s, unwrap<ItemNameId>(sd->inventory_data[index]->nameid)}, }; - sd->state.lr_flag = 2; + sd->state.lr_flag_is_arrow_2 = 1; run_script_l(ScriptPointer(sd->inventory_data[index]->equip_script.get(), 0), sd->bl_id, BlockId(), arg); - sd->state.lr_flag = 0; + sd->state.lr_flag_is_arrow_2 = 0; sd->arrow_atk += sd->inventory_data[index]->atk; } } @@ -1180,10 +1117,6 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) if (sd->attackrange < 1) sd->attackrange = 1; - if (sd->attackrange_ < 1) - sd->attackrange_ = 1; - if (sd->attackrange < sd->attackrange_) - sd->attackrange = sd->attackrange_; if (sd->status.weapon == ItemLook::BOW) sd->attackrange += sd->arrow_range; sd->double_rate += sd->double_add_rate; @@ -1201,9 +1134,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) for (ATTR attr : ATTRs) sd->paramc[attr] = std::max(0, sd->status.attrs[attr] + sd->paramb[attr] + sd->parame[attr]); - if (sd->status.weapon == ItemLook::BOW - || sd->status.weapon == ItemLook::_13 - || sd->status.weapon == ItemLook::_14) + if (sd->status.weapon == ItemLook::BOW) { str = sd->paramc[ATTR::DEX]; dex = sd->paramc[ATTR::STR]; @@ -1291,20 +1222,11 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) sd->mdef2 = 1; // 二刀流 ASPD 修正 - if (sd->status.weapon < ItemLook::SINGLE_HANDED_COUNT) + { sd->aspd += aspd_base_0[sd->status.weapon] - (sd->paramc[ATTR::AGI] * 4 + sd->paramc[ATTR::DEX]) * aspd_base_0[sd->status.weapon] / 1000; - else - sd->aspd += ( - (aspd_base_0[sd->weapontype1] - - (sd->paramc[ATTR::AGI] * 4 + sd->paramc[ATTR::DEX]) - * aspd_base_0[sd->weapontype1] / 1000) - + (aspd_base_0[sd->weapontype2] - - (sd->paramc[ATTR::AGI] * 4 + sd->paramc[ATTR::DEX]) - * aspd_base_0[sd->weapontype2] / 1000) - ) - * 140 / 200; + } aspd_rate = sd->aspd_rate; @@ -1498,122 +1420,116 @@ int pc_bonus(dumb_ptr<map_session_data> sd, SP type, int val) case SP::INT: case SP::DEX: case SP::LUK: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->parame[sp_to_attr(type)] += val; break; #if 0 case SP::ATK1: - if (!sd->state.lr_flag) + if (!sd->state.lr_flag_is_arrow_2) sd->watk += val; - else if (sd->state.lr_flag == 1) - sd->watk_ += val; break; #endif #if 0 case SP::ATK2: - if (!sd->state.lr_flag) + if (!sd->state.lr_flag_is_arrow_2) sd->watk2 += val; - else if (sd->state.lr_flag == 1) - sd->watk_2 += val; break; #endif #if 0 case SP::BASE_ATK: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->base_atk += val; break; #endif #if 0 case SP::MATK1: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->matk1 += val; break; #endif #if 0 case SP::MATK2: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->matk2 += val; break; #endif #if 0 case SP::DEF1: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->def += val; break; #endif case SP::MDEF1: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->mdef += val; break; #if 0 case SP::MDEF2: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->mdef += val; break; #endif case SP::HIT: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->hit += val; else sd->arrow_hit += val; break; case SP::FLEE1: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->flee += val; break; #if 0 case SP::FLEE2: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->flee2 += val * 10; break; #endif case SP::CRITICAL: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->critical += val * 10; else sd->arrow_cri += val * 10; break; case SP::MAXHP: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->status.max_hp += val; break; case SP::MAXSP: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->status.max_sp += val; break; case SP::MAXHPRATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->hprate += val; break; #if 0 case SP::MAXSPRATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->sprate += val; break; #endif #if 0 case SP::SPRATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->dsprate += val; break; #endif case SP::ATTACKRANGE: - if (!sd->state.lr_flag) + if (!sd->state.lr_flag_is_arrow_2) sd->attackrange += val; - else if (sd->state.lr_flag == 1) - sd->attackrange_ += val; - else if (sd->state.lr_flag == 2) + else sd->arrow_range += val; break; #if 0 case SP::ADD_SPEED: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->speed -= val; break; #endif #if 0 case SP::SPEED_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) { if (sd->speed_rate > 100 - val) sd->speed_rate = 100 - val; @@ -1621,17 +1537,17 @@ int pc_bonus(dumb_ptr<map_session_data> sd, SP type, int val) break; #endif case SP::SPEED_ADDRATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->speed_add_rate = sd->speed_add_rate * (100 - val) / 100; break; #if 0 case SP::ASPD: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->aspd -= val * 10; break; #endif case SP::ASPD_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) { if (sd->aspd_rate > 100 - val) sd->aspd_rate = 100 - val; @@ -1639,99 +1555,99 @@ int pc_bonus(dumb_ptr<map_session_data> sd, SP type, int val) break; #if 0 case SP::ASPD_ADDRATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->aspd_add_rate = sd->aspd_add_rate * (100 - val) / 100; break; #endif case SP::HP_RECOV_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->hprecov_rate += val; break; #if 0 case SP::SP_RECOV_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->sprecov_rate += val; break; #endif case SP::CRITICAL_DEF: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->critical_def += val; break; #if 0 case SP::DOUBLE_RATE: - if (sd->state.lr_flag == 0 && sd->double_rate < val) + if (!sd->state.lr_flag_is_arrow_2 && sd->double_rate < val) sd->double_rate = val; break; #endif case SP::DOUBLE_ADD_RATE: - if (sd->state.lr_flag == 0) + if (!sd->state.lr_flag_is_arrow_2) sd->double_add_rate += val; break; #if 0 case SP::MATK_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->matk_rate += val; break; #endif #if 0 case SP::ATK_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->atk_rate += val; break; #endif #if 0 case SP::PERFECT_HIT_RATE: - if (sd->state.lr_flag != 2 && sd->perfect_hit < val) + if (!sd->state.lr_flag_is_arrow_2 && sd->perfect_hit < val) sd->perfect_hit = val; break; #endif #if 0 case SP::PERFECT_HIT_ADD_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->perfect_hit_add += val; break; #endif #if 0 case SP::CRITICAL_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->critical_rate += val; break; #endif #if 0 case SP::HIT_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->hit_rate += val; break; #endif #if 0 case SP::FLEE_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->flee_rate += val; break; #endif #if 0 case SP::FLEE2_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->flee2_rate += val; break; #endif case SP::DEF_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->def_rate += val; break; case SP::DEF2_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->def2_rate += val; break; #if 0 case SP::MDEF_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->mdef_rate += val; break; #endif #if 0 case SP::MDEF2_RATE: - if (sd->state.lr_flag != 2) + if (!sd->state.lr_flag_is_arrow_2) sd->mdef2_rate += val; break; #endif @@ -1758,29 +1674,19 @@ int pc_bonus2(dumb_ptr<map_session_data> sd, SP type, int type2, int val) switch (type) { case SP::HP_DRAIN_RATE: - if (!sd->state.lr_flag) + if (!sd->state.lr_flag_is_arrow_2) { sd->hp_drain_rate += type2; sd->hp_drain_per += val; } - else if (sd->state.lr_flag == 1) - { - sd->hp_drain_rate_ += type2; - sd->hp_drain_per_ += val; - } break; #if 0 case SP::SP_DRAIN_RATE: - if (!sd->state.lr_flag) + if (!sd->state.lr_flag_is_arrow_2) { sd->sp_drain_rate += type2; sd->sp_drain_per += val; } - else if (sd->state.lr_flag == 1) - { - sd->sp_drain_rate_ += type2; - sd->sp_drain_per_ += val; - } break; #endif default: @@ -4499,20 +4405,16 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, IOff0 n, EPOS) { if (sd->inventory_data[n]->type == ItemType::WEAPON) { - sd->status.shield = ItemNameId(); - if (sd->status.inventory[n].equip == EPOS::SHIELD) - sd->weapontype2 = view_l; + assert(0 && "unreachable - offhand weapons are not supported"); } else if (sd->inventory_data[n]->type == ItemType::ARMOR) { sd->status.shield = view_i; - sd->weapontype2 = ItemLook::NONE; } } else { sd->status.shield = ItemNameId(); - sd->weapontype2 = ItemLook::NONE; } pc_calcweapontype(sd); clif_changelook(sd, LOOK::SHIELD, unwrap<ItemNameId>(sd->status.shield)); @@ -4563,14 +4465,14 @@ int pc_unequipitem(dumb_ptr<map_session_data> sd, IOff0 n, CalcStatus type) if (bool(sd->status.inventory[n].equip & EPOS::WEAPON)) { sd->weapontype1 = ItemLook::NONE; - sd->status.weapon = sd->weapontype2; + // when reading the diff, think twice about this + sd->status.weapon = ItemLook::NONE; pc_calcweapontype(sd); pc_set_weapon_look(sd); } if (bool(sd->status.inventory[n].equip & EPOS::SHIELD)) { sd->status.shield = ItemNameId(); - sd->weapontype2 = ItemLook::NONE; pc_calcweapontype(sd); clif_changelook(sd, LOOK::SHIELD, unwrap<ItemNameId>(sd->status.shield)); } @@ -4936,28 +4838,7 @@ int pc_natural_heal_hp(dumb_ptr<map_session_data> sd) if (bhp != sd->status.hp) clif_updatestatus(sd, SP::HP); - if (sd->nshealhp > 0) - { - if (sd->inchealhptick >= static_cast<interval_t>(battle_config.natural_heal_skill_interval) - && sd->status.hp < sd->status.max_hp) - { - bonus = sd->nshealhp; - while (sd->inchealhptick >= static_cast<interval_t>(battle_config.natural_heal_skill_interval)) - { - sd->inchealhptick -= static_cast<interval_t>(battle_config.natural_heal_skill_interval); - if (sd->status.hp + bonus <= sd->status.max_hp) - sd->status.hp += bonus; - else - { - bonus = sd->status.max_hp - sd->status.hp; - sd->status.hp = sd->status.max_hp; - sd->hp_sub = sd->inchealhptick = interval_t::zero(); - } - } - } - } - else - sd->inchealhptick = interval_t::zero(); + sd->inchealhptick = interval_t::zero(); return 0; } @@ -5004,28 +4885,7 @@ int pc_natural_heal_sp(dumb_ptr<map_session_data> sd) if (bsp != sd->status.sp) clif_updatestatus(sd, SP::SP); - if (sd->nshealsp > 0) - { - if (sd->inchealsptick >= static_cast<interval_t>(battle_config.natural_heal_skill_interval) - && sd->status.sp < sd->status.max_sp) - { - bonus = sd->nshealsp; - while (sd->inchealsptick >= static_cast<interval_t>(battle_config.natural_heal_skill_interval)) - { - sd->inchealsptick -= static_cast<interval_t>(battle_config.natural_heal_skill_interval); - if (sd->status.sp + bonus <= sd->status.max_sp) - sd->status.sp += bonus; - else - { - bonus = sd->status.max_sp - sd->status.sp; - sd->status.sp = sd->status.max_sp; - sd->sp_sub = sd->inchealsptick = interval_t::zero(); - } - } - } - } - else - sd->inchealsptick = interval_t::zero(); + sd->inchealsptick = interval_t::zero(); return 0; } diff --git a/src/map/script.cpp b/src/map/script.cpp index 952df5b..b06771d 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -3299,7 +3299,6 @@ void builtin_pvpon(ScriptState *st) std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, pl_sd->bl_id)); pl_sd->pvp_rank = 0; - pl_sd->pvp_lastusers = 0; pl_sd->pvp_point = 5; } } diff --git a/src/map/skill.cpp b/src/map/skill.cpp index d1c8685..7c79e46 100644 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -286,7 +286,7 @@ int skill_attack(BF attack_type, dumb_ptr<block_list> src, lv = flag.level; dmg = battle_calc_attack(attack_type, src, bl, skillid, skilllv, flag.lo); //ダメージ計算 - damage = dmg.damage + dmg.damage2; + damage = dmg.damage; if (lv == 15) lv = -1; @@ -347,26 +347,16 @@ int skill_attack(BF attack_type, dumb_ptr<block_list> src, { hp += (dmg.damage * sd->hp_drain_per) / 100; } - if (sd->hp_drain_rate_ && dmg.damage2 > 0 - && random_::chance({sd->hp_drain_rate_, 100})) - { - hp += (dmg.damage2 * sd->hp_drain_per_) / 100; - } if (sd->sp_drain_rate > 0 && dmg.damage > 0 && random_::chance({sd->sp_drain_rate, 100})) { sp += (dmg.damage * sd->sp_drain_per) / 100; } - if (sd->sp_drain_rate_ > 0 && dmg.damage2 > 0 - && random_::chance({sd->sp_drain_rate_, 100})) - { - sp += (dmg.damage2 * sd->sp_drain_per_) / 100; - } if (hp || sp) pc_heal(sd, hp, sp); } - return (dmg.damage + dmg.damage2); /* 与ダメを返す */ + return (dmg.damage); /* 与ダメを返す */ } typedef int(*SkillFunc)(dumb_ptr<block_list>, dumb_ptr<block_list>, |