diff options
Diffstat (limited to 'src/map/skill.cpp')
-rw-r--r-- | src/map/skill.cpp | 403 |
1 files changed, 198 insertions, 205 deletions
diff --git a/src/map/skill.cpp b/src/map/skill.cpp index a93f375..ed9e551 100644 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -20,37 +20,37 @@ struct skill_name_db skill_names[] = { - {AC_OWL, "OWL", "Owl's_Eye"}, - - {NPC_EMOTION, "EMOTION", "NPC_EMOTION"}, - {NPC_POISON, "POISON", "NPC_POISON"}, - {NPC_SELFDESTRUCTION, "SELFDESTRUCTION", "Kabooooom!"}, - {NPC_SUMMONSLAVE, "SUMMONSLAVE", "NPC_SUMMONSLAVE"}, - - {NV_EMOTE, "EMOTE", "Emote_Skill"}, - {NV_TRADE, "TRADE", "Trade_Skill"}, - {NV_PARTY, "PARTY", "Party_Skill"}, - - {TMW_MAGIC, "MAGIC", "General Magic"}, - {TMW_MAGIC_LIFE, "MAGIC_LIFE", "Life Magic"}, - {TMW_MAGIC_WAR, "MAGIC_WAR", "War Magic"}, - {TMW_MAGIC_TRANSMUTE, "MAGIC_TRANSMUTE", "Transmutation Magic"}, - {TMW_MAGIC_NATURE, "MAGIC_NATURE", "Nature Magic"}, - {TMW_MAGIC_ETHER, "MAGIC_ETHER", "Astral Magic"}, - {TMW_MAGIC_DARK, "MAGIC_DARK", "Dark Magic"}, - {TMW_MAGIC_LIGHT, "MAGIC_LIGHT", "Light Magic"}, - - {TMW_BRAWLING, "BRAWLING", "Brawling"}, - {TMW_LUCKY_COUNTER, "LUCKY_COUNTER", "Lucky Counter"}, - {TMW_SPEED, "SPEED", "Speed"}, - {TMW_RESIST_POISON, "RESIST_POISON", "Resist Poison"}, - {TMW_ASTRAL_SOUL, "ASTRAL_SOUL", "Astral Soul"}, - {TMW_RAGING, "RAGING", "Raging"}, + {SkillID::AC_OWL, "OWL", "Owl's_Eye"}, + + {SkillID::NPC_EMOTION, "EMOTION", "NPC_EMOTION"}, + {SkillID::NPC_POISON, "POISON", "NPC_POISON"}, + {SkillID::NPC_SELFDESTRUCTION, "SELFDESTRUCTION", "Kabooooom!"}, + {SkillID::NPC_SUMMONSLAVE, "SUMMONSLAVE", "NPC_SUMMONSLAVE"}, + + {SkillID::NV_EMOTE, "EMOTE", "Emote_Skill"}, + {SkillID::NV_TRADE, "TRADE", "Trade_Skill"}, + {SkillID::NV_PARTY, "PARTY", "Party_Skill"}, + + {SkillID::TMW_MAGIC, "MAGIC", "General Magic"}, + {SkillID::TMW_MAGIC_LIFE, "MAGIC_LIFE", "Life Magic"}, + {SkillID::TMW_MAGIC_WAR, "MAGIC_WAR", "War Magic"}, + {SkillID::TMW_MAGIC_TRANSMUTE, "MAGIC_TRANSMUTE", "Transmutation Magic"}, + {SkillID::TMW_MAGIC_NATURE, "MAGIC_NATURE", "Nature Magic"}, + {SkillID::TMW_MAGIC_ETHER, "MAGIC_ETHER", "Astral Magic"}, + {SkillID::TMW_MAGIC_DARK, "MAGIC_DARK", "Dark Magic"}, + {SkillID::TMW_MAGIC_LIGHT, "MAGIC_LIGHT", "Light Magic"}, + + {SkillID::TMW_BRAWLING, "BRAWLING", "Brawling"}, + {SkillID::TMW_LUCKY_COUNTER, "LUCKY_COUNTER", "Lucky Counter"}, + {SkillID::TMW_SPEED, "SPEED", "Speed"}, + {SkillID::TMW_RESIST_POISON, "RESIST_POISON", "Resist Poison"}, + {SkillID::TMW_ASTRAL_SOUL, "ASTRAL_SOUL", "Astral Soul"}, + {SkillID::TMW_RAGING, "RAGING", "Raging"}, {SkillID::ZERO, nullptr, nullptr} }; -earray<struct skill_db, SkillID, MAX_SKILL_DB> skill_db; +earray<struct skill_db, SkillID, SkillID::MAX_SKILL_DB> skill_db; static @@ -162,21 +162,21 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl, if (skilllv < 0) return 0; - if (src->type == BL_PC) + if (src->type == BL::PC) { sd = (struct map_session_data *) src; nullpo_ret(sd); } - else if (src->type == BL_MOB) + else if (src->type == BL::MOB) { md = (struct mob_data *) src; nullpo_ret(md); //未使用? } sc_def_phys_shield_spell = 0; - if (battle_get_sc_data(bl)[SC_PHYS_SHIELD].timer != -1) + if (battle_get_sc_data(bl)[StatusChange::SC_PHYS_SHIELD].timer != -1) sc_def_phys_shield_spell = - battle_get_sc_data(bl)[SC_PHYS_SHIELD].val1; + battle_get_sc_data(bl)[StatusChange::SC_PHYS_SHIELD].val1; //対象の耐性 luk = battle_get_luk(bl); @@ -187,7 +187,7 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl, //自分の耐性 luk = battle_get_luk(src); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) { if (sc_def_mdef > 50) sc_def_mdef = 50; @@ -207,11 +207,11 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl, switch (skillid) { - case NPC_POISON: + case SkillID::NPC_POISON: if (MRAND(100) < 50 - (sc_def_vit >> 2) - (sc_def_phys_shield_spell) + (skilllv >> 2)) - skill_status_change_start(bl, SC_POISON, + skill_status_change_start(bl, StatusChange::SC_POISON, skilllv, 0, 0, 0, skilllv, 0); break; } @@ -250,15 +250,15 @@ int skill_attack(BF attack_type, struct block_list *src, return 0; if (src->prev == NULL || dsrc->prev == NULL || bl->prev == NULL) //prevよくわからない※ return 0; - if (src->type == BL_PC && pc_isdead((struct map_session_data *) src)) //術者?がPCですでに死んでいたら何もしない + if (src->type == BL::PC && pc_isdead((struct map_session_data *) src)) //術者?がPCですでに死んでいたら何もしない return 0; - if (dsrc->type == BL_PC && pc_isdead((struct map_session_data *) dsrc)) //術者?がPCですでに死んでいたら何もしない + if (dsrc->type == BL::PC && pc_isdead((struct map_session_data *) dsrc)) //術者?がPCですでに死んでいたら何もしない return 0; - if (bl->type == BL_PC && pc_isdead((struct map_session_data *) bl)) //対象がPCですでに死んでいたら何もしない + if (bl->type == BL::PC && pc_isdead((struct map_session_data *) bl)) //対象がPCですでに死んでいたら何もしない return 0; - if (src->type == BL_PC && ((struct map_session_data *) src)->chatID) //術者がPCでチャット中なら何もしない + if (src->type == BL::PC && ((struct map_session_data *) src)->chatID) //術者がPCでチャット中なら何もしない return 0; - if (dsrc->type == BL_PC && ((struct map_session_data *) dsrc)->chatID) //術者がPCでチャット中なら何もしない + if (dsrc->type == BL::PC && ((struct map_session_data *) dsrc)->chatID) //術者がPCでチャット中なら何もしない return 0; //何もしない判定ここまで @@ -277,7 +277,7 @@ int skill_attack(BF attack_type, struct block_list *src, switch (skillid) { - case NPC_SELFDESTRUCTION: + case SkillID::NPC_SELFDESTRUCTION: break; default: clif_skill_damage(dsrc, bl, tick, dmg.amotion, dmg.dmotion, @@ -295,12 +295,12 @@ int skill_attack(BF attack_type, struct block_list *src, { struct map_session_data *sd = (struct map_session_data *) bl; nullpo_ret(sd); - if (bl->type != BL_PC || (sd && !pc_isdead(sd))) + if (bl->type != BL::PC || (sd && !pc_isdead(sd))) { if (damage > 0) skill_additional_effect(src, bl, skillid, skilllv, attack_type, tick); - if (bl->type == BL_MOB && src != bl) /* スキル使用条件のMOBスキル */ + if (bl->type == BL::MOB && src != bl) /* スキル使用条件のMOBスキル */ { struct mob_data *md = (struct mob_data *) bl; nullpo_ret(md); @@ -308,7 +308,7 @@ int skill_attack(BF attack_type, struct block_list *src, { int target; target = md->target_id; - if (src->type == BL_PC) + if (src->type == BL::PC) md->target_id = src->id; mobskill_use(md, tick, MobSkillCondition::ANY, skillid); md->target_id = target; @@ -319,8 +319,8 @@ int skill_attack(BF attack_type, struct block_list *src, } } - if (src->type == BL_PC - && bool(dmg.flag & BF_WEAPON) + if (src->type == BL::PC + && bool(dmg.flag & BF::WEAPON) && src != bl && src == dsrc && damage > 0) @@ -368,7 +368,7 @@ void skill_area_sub(struct block_list *bl, { nullpo_retv(bl); - if (bl->type != BL_PC && bl->type != BL_MOB) + if (bl->type != BL::PC && bl->type != BL::MOB) return; if (battle_check_target(src, bl, flag) > 0) @@ -398,35 +398,35 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, nullpo_retr(1, src); nullpo_retr(1, bl); - if (src->type == BL_PC) + if (src->type == BL::PC) sd = (struct map_session_data *) src; if (sd && pc_isdead(sd)) return 1; if (bl->prev == NULL) return 1; - if (bl->type == BL_PC && pc_isdead((struct map_session_data *) bl)) + if (bl->type == BL::PC && pc_isdead((struct map_session_data *) bl)) return 1; map_freeblock_lock(); switch (skillid) { - case NPC_POISON: - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, + case SkillID::NPC_POISON: + skill_attack(BF::WEAPON, src, src, bl, skillid, skilllv, tick, flag); break; - case NPC_SELFDESTRUCTION: /* 自爆 */ + case SkillID::NPC_SELFDESTRUCTION: /* 自爆 */ if (flag.lo & 1) { /* 個別にダメージを与える */ - if (src->type == BL_MOB) + if (src->type == BL::MOB) { struct mob_data *mb = (struct mob_data *) src; nullpo_retr(1, mb); mb->hp = skill_area_temp_hp; if (bl->id != skill_area_temp_id) - skill_attack(BF_MISC, src, src, bl, - NPC_SELFDESTRUCTION, skilllv, tick, + skill_attack(BF::MISC, src, src, bl, + SkillID::NPC_SELFDESTRUCTION, skilllv, tick, flag); mb->hp = 1; } @@ -440,7 +440,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, skill_area_temp_hp = battle_get_hp(src); map_foreachinarea(std::bind(skill_area_sub, ph::_1, src, skillid, skilllv, tick, flag | BCT_ENEMY | BCT_lo_x01, skill_castend_damage_id), bl->m, bl->x - 5, bl->y - 5, - bl->x + 5, bl->y + 5, BL_NUL); + bl->x + 5, bl->y + 5, BL::NUL); battle_damage(src, src, md->hp, 0); } } @@ -453,7 +453,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, if (flag.lo & 3) { if (bl->id != skill_area_temp_id) - skill_attack(BF_WEAPON, src, src, bl, skillid, + skill_attack(BF::WEAPON, src, src, bl, skillid, skilllv, tick, BCT_mid_x05); } else @@ -462,7 +462,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, skill_area_temp_id = bl->id; map_foreachinarea(std::bind(skill_area_sub, ph::_1, src, skillid, skilllv, tick, flag | BCT_ENEMY | BCT_lo_x01, skill_castend_damage_id), bl->m, bl->x - 0, bl->y - 0, - bl->x + 0, bl->y + 0, BL_NUL); + bl->x + 0, bl->y + 0, BL::NUL); } } break; @@ -481,7 +481,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, *------------------------------------------ */ // skillid.nk == 1 -// so skillid in (NPC_SUMMONSLAVE, NPC_EMOTION) +// so skillid in (SkillID::NPC_SUMMONSLAVE, SkillID::NPC_EMOTION) int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, SkillID skillid, int skilllv, unsigned int, BCT) @@ -495,9 +495,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, nullpo_retr(1, src); nullpo_retr(1, bl); - if (src->type == BL_PC) + if (src->type == BL::PC) sd = (struct map_session_data *) src; - else if (src->type == BL_MOB) + else if (src->type == BL::MOB) md = (struct mob_data *) src; sc_def_vit = 100 - (3 + battle_get_vit(bl) + battle_get_luk(bl) / 3); @@ -505,12 +505,12 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, sc_def_mdef = 100 - (3 + battle_get_mdef(bl) + battle_get_luk(bl) / 3); strip_fix = battle_get_dex(src) - battle_get_dex(bl); - if (bl->type == BL_PC) + if (bl->type == BL::PC) { dstsd = (struct map_session_data *) bl; nullpo_retr(1, dstsd); } - else if (bl->type == BL_MOB) + else if (bl->type == BL::MOB) { dstmd = (struct mob_data *) bl; nullpo_retr(1, dstmd); @@ -536,17 +536,17 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, map_freeblock_lock(); switch (skillid) { - case NPC_SUMMONSLAVE: + case SkillID::NPC_SUMMONSLAVE: if (md && !md->master_id) { mob_summonslave(md, mob_db[md->mob_class].skill[md->skillidx].val, skilllv, - (true) ? 1 : 0); + 1); } break; - case NPC_EMOTION: + case SkillID::NPC_EMOTION: if (md) clif_emotion(&md->bl, mob_db[md->mob_class].skill[md->skillidx].val[0]); @@ -572,7 +572,7 @@ int skill_castfix(struct block_list *bl, int time) nullpo_ret(bl); - if (bl->type == BL_MOB) + if (bl->type == BL::MOB) { // Crash fix [Valaris] md = (struct mob_data *) bl; skill = md->skillid; @@ -587,16 +587,16 @@ int skill_castfix(struct block_list *bl, int time) sc_data = battle_get_sc_data(bl); dex = battle_get_dex(bl); - if (skill > MAX_SKILL_DB /*|| skill < SkillID()*/) + if (skill > SkillID::MAX_SKILL_DB /*|| skill < SkillID()*/) return 0; castnodex = skill_get_castnodex(skill, lv); if (time == 0) return 0; - if (castnodex > 0 && bl->type == BL_PC) + if (castnodex > 0 && bl->type == BL::PC) castrate = 100; - else if (castnodex <= 0 && bl->type == BL_PC) + else if (castnodex <= 0 && bl->type == BL::PC) { castrate = 100; time = @@ -623,7 +623,7 @@ int skill_delayfix(struct block_list *bl, int time) if (time <= 0) return 0; - if (bl->type == BL_PC) + if (bl->type == BL::PC) { if (battle_config.delay_dependon_dex) /* dexの影響を計算する */ time = @@ -646,7 +646,7 @@ int skill_castcancel(struct block_list *bl, int) nullpo_ret(bl); - if (bl->type == BL_PC) + if (bl->type == BL::PC) { struct map_session_data *sd = (struct map_session_data *) bl; unsigned long tick = gettick(); @@ -656,7 +656,7 @@ int skill_castcancel(struct block_list *bl, int) return 0; } - else if (bl->type == BL_MOB) + else if (bl->type == BL::MOB) { struct mob_data *md = (struct mob_data *) bl; nullpo_ret(md); @@ -754,7 +754,7 @@ int skill_status_change_active(struct block_list *bl, StatusChange type) eptr<struct status_change, StatusChange> sc_data; nullpo_ret(bl); - if (bl->type != BL_PC && bl->type != BL_MOB) + if (bl->type != BL::PC && bl->type != BL::MOB) { if (battle_config.error_log) PRINTF("skill_status_change_active: neither MOB nor PC !\n"); @@ -779,7 +779,7 @@ int skill_status_change_end(struct block_list *bl, StatusChange type, int tid) Opt3 *opt3; nullpo_ret(bl); - if (bl->type != BL_PC && bl->type != BL_MOB) + if (bl->type != BL::PC && bl->type != BL::MOB) { if (battle_config.error_log) PRINTF("skill_status_change_end: neither MOB nor PC !\n"); @@ -812,91 +812,84 @@ int skill_status_change_end(struct block_list *bl, StatusChange type, int tid) switch (type) { /* 異常の種類ごとの処理 */ - case SC_SPEEDPOTION0: /* 増速ポーション */ - case SC_ATKPOT: /* attack potion [Valaris] */ - case SC_MATKPOT: /* magic attack potion [Valaris] */ - case SC_PHYS_SHIELD: - case SC_HASTE: + case StatusChange::SC_SPEEDPOTION0: /* 増速ポーション */ + case StatusChange::SC_ATKPOT: /* attack potion [Valaris] */ + case StatusChange::SC_MATKPOT: /* magic attack potion [Valaris] */ + case StatusChange::SC_PHYS_SHIELD: + case StatusChange::SC_HASTE: calc_flag = 1; break; - { - struct map_session_data *md = map_id2sd(sc_data[type].val1); - sc_data[type].val1 = sc_data[type].val2 = 0; - skill_devotion(md, bl->id); - calc_flag = 1; - } - break; - case SC_NOCHAT: //チャット禁止状態 + case StatusChange::SC_NOCHAT: //チャット禁止状態 break; - case SC_SELFDESTRUCTION: /* 自爆 */ + case StatusChange::SC_SELFDESTRUCTION: /* 自爆 */ { //自分のダメージは0にして struct mob_data *md = NULL; - if (bl->type == BL_MOB && (md = (struct mob_data *) bl)) + if (bl->type == BL::MOB && (md = (struct mob_data *) bl)) skill_castend_damage_id(bl, bl, static_cast<SkillID>(sc_data[type].val2), sc_data[type].val1, gettick(), BCT_ZERO); } break; /* option1 */ - case SC_FREEZE: + case StatusChange::SC_FREEZE: sc_data[type].val3 = 0; break; /* option2 */ - case SC_POISON: /* 毒 */ - case SC_BLIND: /* 暗黒 */ - case SC_CURSE: + case StatusChange::SC_POISON: /* 毒 */ + case StatusChange::SC_BLIND: /* 暗黒 */ + case StatusChange::SC_CURSE: calc_flag = 1; break; } - if (bl->type == BL_PC && type < SC_SENDMAX) + if (bl->type == BL::PC && type < StatusChange::SC_SENDMAX) clif_status_change(bl, type, 0); /* アイコン消去 */ switch (type) { /* 正常に戻るときなにか処理が必要 */ - case SC_STONE: - case SC_FREEZE: - case SC_STAN: - case SC_SLEEP: + case StatusChange::SC_STONE: + case StatusChange::SC_FREEZE: + case StatusChange::SC_STAN: + case StatusChange::SC_SLEEP: *opt1 = Opt1::ZERO; opt_flag = 1; break; - case SC_POISON: + case StatusChange::SC_POISON: *opt2 &= ~Opt2::_poison; opt_flag = 1; break; - case SC_CURSE: + case StatusChange::SC_CURSE: *opt2 &= ~Opt2::_curse; opt_flag = 1; break; - case SC_SILENCE: + case StatusChange::SC_SILENCE: *opt2 &= ~Opt2::_silence; opt_flag = 1; break; - case SC_BLIND: + case StatusChange::SC_BLIND: *opt2 &= ~Opt2::BLIND; opt_flag = 1; break; - case SC_SLOWPOISON: - if (sc_data[SC_POISON].timer != -1) + case StatusChange::SC_SLOWPOISON: + if (sc_data[StatusChange::SC_POISON].timer != -1) *opt2 |= Opt2::_poison; *opt2 &= ~Opt2::_slowpoison; opt_flag = 1; break; - case SC_SPEEDPOTION0: + case StatusChange::SC_SPEEDPOTION0: *opt2 &= ~Opt2::_speedpotion0; opt_flag = 1; break; - case SC_ATKPOT: + case StatusChange::SC_ATKPOT: *opt2 &= ~Opt2::_atkpot; opt_flag = 1; break; @@ -904,7 +897,7 @@ int skill_status_change_end(struct block_list *bl, StatusChange type, int tid) if (night_flag == 1 && !bool(*opt2 & Opt2::BLIND) - && bl->type == BL_PC) + && bl->type == BL::PC) { // by [Yor] *opt2 |= Opt2::BLIND; opt_flag = 1; @@ -913,7 +906,7 @@ int skill_status_change_end(struct block_list *bl, StatusChange type, int tid) if (opt_flag) /* optionの変更を伝える */ clif_changeoption(bl); - if (bl->type == BL_PC && calc_flag) + if (bl->type == BL::PC && calc_flag) pc_calcstatus((struct map_session_data *) bl, 0); /* ステータス再計算 */ } @@ -958,7 +951,7 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom if (not sc_data) return; - if (bl->type == BL_PC) + if (bl->type == BL::PC) sd = (struct map_session_data *) bl; //sc_count=battle_get_sc_count(bl); //使ってない? @@ -979,7 +972,7 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom switch (type) { /* 特殊な処理になる場合 */ - case SC_STONE: + case StatusChange::SC_STONE: if (sc_data[type].val2 != 0) { Opt1 *opt1 = battle_get_opt1(bl); @@ -1005,9 +998,9 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom hp = hp / 100; if (hp < 1) hp = 1; - if (bl->type == BL_PC) + if (bl->type == BL::PC) pc_heal((struct map_session_data *) bl, -hp, 0); - else if (bl->type == BL_MOB) + else if (bl->type == BL::MOB) { struct mob_data *md; if ((md = ((struct mob_data *) bl)) == NULL) @@ -1021,11 +1014,11 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom return; } break; - case SC_POISON: - if (sc_data[SC_SLOWPOISON].timer == -1) + case StatusChange::SC_POISON: + if (sc_data[StatusChange::SC_SLOWPOISON].timer == -1) { const int resist_poison = - skill_power_bl(bl, TMW_RESIST_POISON) >> 3; + skill_power_bl(bl, SkillID::TMW_RESIST_POISON) >> 3; if (resist_poison) sc_data[type].val1 -= MRAND(resist_poison + 1); @@ -1035,12 +1028,12 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom int hp = battle_get_max_hp(bl); if (battle_get_hp(bl) > hp >> 4) { - if (bl->type == BL_PC) + if (bl->type == BL::PC) { hp = 3 + hp * 3 / 200; pc_heal((struct map_session_data *) bl, -hp, 0); } - else if (bl->type == BL_MOB) + else if (bl->type == BL::MOB) { struct mob_data *md; if ((md = ((struct mob_data *) bl)) == NULL) @@ -1061,17 +1054,17 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom break; /* 時間切れ無し?? */ - case SC_WEIGHT50: - case SC_WEIGHT90: - case SC_BROKNWEAPON: - case SC_BROKNARMOR: + case StatusChange::SC_WEIGHT50: + case StatusChange::SC_WEIGHT90: + case StatusChange::SC_BROKNWEAPON: + case StatusChange::SC_BROKNARMOR: if (sc_data[type].timer == tid) sc_data[type].timer = add_timer(1000 * 600 + tick, skill_status_change_timer, bl->id, data); return; - case SC_NOCHAT: //チャット禁止状態 + case StatusChange::SC_NOCHAT: //チャット禁止状態 if (sd && battle_config.muting_players) { time_t timer; @@ -1087,14 +1080,14 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom } } break; - case SC_SELFDESTRUCTION: /* 自爆 */ + case StatusChange::SC_SELFDESTRUCTION: /* 自爆 */ if (--sc_data[type].val3 > 0) { struct mob_data *md; - if (bl->type == BL_MOB && (md = (struct mob_data *) bl) - && md->stats[MOB_SPEED] > 250) + if (bl->type == BL::MOB && (md = (struct mob_data *) bl) + && md->stats[mob_stat::SPEED] > 250) { - md->stats[MOB_SPEED] -= 250; + md->stats[mob_stat::SPEED] -= 250; md->next_walktime = tick; } sc_data[type].timer = add_timer( /* タイマー再設定 */ @@ -1105,8 +1098,8 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom } break; - case SC_FLYING_BACKPACK: - clif_updatestatus(sd, SP_WEIGHT); + case StatusChange::SC_FLYING_BACKPACK: + clif_updatestatus(sd, SP::WEIGHT); break; } @@ -1164,34 +1157,34 @@ int skill_status_effect(struct block_list *bl, StatusChange type, switch (type) { - case SC_STONE: - case SC_FREEZE: + case StatusChange::SC_STONE: + case StatusChange::SC_FREEZE: scdef = 3 + battle_get_mdef(bl) + battle_get_luk(bl) / 3; break; - case SC_STAN: - case SC_SILENCE: - case SC_POISON: + case StatusChange::SC_STAN: + case StatusChange::SC_SILENCE: + case StatusChange::SC_POISON: scdef = 3 + battle_get_vit(bl) + battle_get_luk(bl) / 3; break; - case SC_SLEEP: - case SC_BLIND: + case StatusChange::SC_SLEEP: + case StatusChange::SC_BLIND: scdef = 3 + battle_get_int(bl) + battle_get_luk(bl) / 3; break; - case SC_CURSE: + case StatusChange::SC_CURSE: scdef = 3 + battle_get_luk(bl); break; -// case SC_CONFUSION: +// case StatusChange::SC_CONFUSION: default: scdef = 0; } if (scdef >= 100) return 0; - if (bl->type == BL_PC) + if (bl->type == BL::PC) { sd = (struct map_session_data *) bl; } - else if (bl->type == BL_MOB) + else if (bl->type == BL::MOB) { } else @@ -1201,32 +1194,32 @@ int skill_status_effect(struct block_list *bl, StatusChange type, return 0; } - if (type == SC_FREEZE && undead_flag && !(flag & 1)) + if (type == StatusChange::SC_FREEZE && undead_flag && !(flag & 1)) return 0; if (bool(mode & MobMode::BOSS) - && (type == SC_STONE - || type == SC_FREEZE - || type == SC_STAN - || type == SC_SLEEP - || type == SC_SILENCE + && (type == StatusChange::SC_STONE + || type == StatusChange::SC_FREEZE + || type == StatusChange::SC_STAN + || type == StatusChange::SC_SLEEP + || type == StatusChange::SC_SILENCE ) && !(flag & 1)) { /* ボスには効かない(ただしカードによる効果は適用される) */ return 0; } - if (type == SC_FREEZE || type == SC_STAN || type == SC_SLEEP) + if (type == StatusChange::SC_FREEZE || type == StatusChange::SC_STAN || type == StatusChange::SC_SLEEP) battle_stopwalking(bl, 1); if (sc_data[type].timer != -1) { /* すでに同じ異常になっている場合タイマ解除 */ if (sc_data[type].val1 > val1 - && type != SC_SPEEDPOTION0 - && type != SC_ATKPOT - && type != SC_MATKPOT) // added atk and matk potions [Valaris] + && type != StatusChange::SC_SPEEDPOTION0 + && type != StatusChange::SC_ATKPOT + && type != StatusChange::SC_MATKPOT) // added atk and matk potions [Valaris] return 0; - if (type >= SC_STAN && type <= SC_BLIND) + if (type >= StatusChange::SC_STAN && type <= StatusChange::SC_BLIND) return 0; /* 継ぎ足しができない状態異常である時は状態異常を行わない */ { (*sc_count)--; @@ -1237,28 +1230,28 @@ int skill_status_effect(struct block_list *bl, StatusChange type, switch (type) { /* 異常の種類ごとの処理 */ - case SC_SLOWPOISON: - if (sc_data[SC_POISON].timer == -1) + case StatusChange::SC_SLOWPOISON: + if (sc_data[StatusChange::SC_POISON].timer == -1) return 0; break; - case SC_SPEEDPOTION0: /* 増速ポーション */ + case StatusChange::SC_SPEEDPOTION0: /* 増速ポーション */ *opt2 |= Opt2::_speedpotion0; calc_flag = 1; tick = 1000 * tick; -// val2 = 5*(2+type-SC_SPEEDPOTION0); +// val2 = 5*(2+type-StatusChange::SC_SPEEDPOTION0); break; /* atk & matk potions [Valaris] */ - case SC_ATKPOT: + case StatusChange::SC_ATKPOT: *opt2 |= Opt2::_atkpot; FALLTHROUGH; - case SC_MATKPOT: + case StatusChange::SC_MATKPOT: calc_flag = 1; tick = 1000 * tick; break; - case SC_NOCHAT: //チャット禁止状態 + case StatusChange::SC_NOCHAT: //チャット禁止状態 { time_t timer; @@ -1271,13 +1264,13 @@ int skill_status_effect(struct block_list *bl, StatusChange type, // updateflag = SP_MANNER; } break; - case SC_SELFDESTRUCTION: //自爆 + case StatusChange::SC_SELFDESTRUCTION: //自爆 val3 = tick / 1000; tick = 1000; break; /* option1 */ - case SC_STONE: /* 石化 */ + case StatusChange::SC_STONE: /* 石化 */ if (!(flag & 2)) { int sc_def = battle_get_mdef(bl) * 200; @@ -1289,7 +1282,7 @@ int skill_status_effect(struct block_list *bl, StatusChange type, tick = 5000; val2 = 1; break; - case SC_SLEEP: /* 睡眠 */ + case StatusChange::SC_SLEEP: /* 睡眠 */ if (!(flag & 2)) { // int sc_def = 100 - (battle_get_int(bl) + battle_get_luk(bl)/3); @@ -1298,14 +1291,14 @@ int skill_status_effect(struct block_list *bl, StatusChange type, tick = 30000; //睡眠はステータス耐性に関わらず30秒 } break; - case SC_FREEZE: /* 凍結 */ + case StatusChange::SC_FREEZE: /* 凍結 */ if (!(flag & 2)) { int sc_def = 100 - battle_get_mdef(bl); tick = tick * sc_def / 100; } break; - case SC_STAN: /* スタン(val2にミリ秒セット) */ + case StatusChange::SC_STAN: /* スタン(val2にミリ秒セット) */ if (!(flag & 2)) { int sc_def = @@ -1315,7 +1308,7 @@ int skill_status_effect(struct block_list *bl, StatusChange type, break; /* option2 */ - case SC_POISON: /* 毒 */ + case StatusChange::SC_POISON: /* 毒 */ calc_flag = 1; if (!(flag & 2)) { @@ -1328,14 +1321,14 @@ int skill_status_effect(struct block_list *bl, StatusChange type, val3 = 1; tick = 1000; break; - case SC_SILENCE: /* 沈黙(レックスデビーナ) */ + case StatusChange::SC_SILENCE: /* 沈黙(レックスデビーナ) */ if (!(flag & 2)) { int sc_def = 100 - battle_get_vit(bl); tick = tick * sc_def / 100; } break; - case SC_BLIND: /* 暗黒 */ + case StatusChange::SC_BLIND: /* 暗黒 */ calc_flag = 1; if (!(flag & 2)) { @@ -1344,7 +1337,7 @@ int skill_status_effect(struct block_list *bl, StatusChange type, tick = 30000 - sc_def; } break; - case SC_CURSE: + case StatusChange::SC_CURSE: calc_flag = 1; if (!(flag & 2)) { @@ -1353,23 +1346,23 @@ int skill_status_effect(struct block_list *bl, StatusChange type, } break; - case SC_WEIGHT50: - case SC_WEIGHT90: - case SC_BROKNWEAPON: - case SC_BROKNARMOR: + case StatusChange::SC_WEIGHT50: + case StatusChange::SC_WEIGHT90: + case StatusChange::SC_BROKNWEAPON: + case StatusChange::SC_BROKNARMOR: tick = 600 * 1000; break; - case SC_HASTE: + case StatusChange::SC_HASTE: calc_flag = 1; break; - case SC_PHYS_SHIELD: - case SC_MBARRIER: - case SC_HALT_REGENERATE: - case SC_HIDE: + case StatusChange::SC_PHYS_SHIELD: + case StatusChange::SC_MBARRIER: + case StatusChange::SC_HALT_REGENERATE: + case StatusChange::SC_HIDE: break; - case SC_FLYING_BACKPACK: - updateflag = SP_WEIGHT; + case StatusChange::SC_FLYING_BACKPACK: + updateflag = SP::WEIGHT; break; default: if (battle_config.error_log) @@ -1377,16 +1370,16 @@ int skill_status_effect(struct block_list *bl, StatusChange type, return 0; } - if (bl->type == BL_PC && type < SC_SENDMAX) + if (bl->type == BL::PC && type < StatusChange::SC_SENDMAX) clif_status_change(bl, type, 1); /* アイコン表示 */ /* optionの変更 */ switch (type) { - case SC_STONE: - case SC_FREEZE: - case SC_STAN: - case SC_SLEEP: + case StatusChange::SC_STONE: + case StatusChange::SC_FREEZE: + case StatusChange::SC_STAN: + case StatusChange::SC_SLEEP: battle_stopattack(bl); /* 攻撃停止 */ skill_stop_dancing(bl, 0); /* 演奏/ダンスの中断 */ /* 同時に掛からないステータス異常を解除 */ @@ -1402,35 +1395,35 @@ int skill_status_effect(struct block_list *bl, StatusChange type, } switch (type) { - case SC_STONE: *opt1 = Opt1::_stone6; break; - case SC_FREEZE: *opt1 = Opt1::_freeze; break; - case SC_STAN: *opt1 = Opt1::_stan; break; - case SC_SLEEP: *opt1 = Opt1::_sleep; break; + case StatusChange::SC_STONE: *opt1 = Opt1::_stone6; break; + case StatusChange::SC_FREEZE: *opt1 = Opt1::_freeze; break; + case StatusChange::SC_STAN: *opt1 = Opt1::_stan; break; + case StatusChange::SC_SLEEP: *opt1 = Opt1::_sleep; break; } opt_flag = 1; break; - case SC_POISON: - if (sc_data[SC_SLOWPOISON].timer == -1) + case StatusChange::SC_POISON: + if (sc_data[StatusChange::SC_SLOWPOISON].timer == -1) { *opt2 |= Opt2::_poison; opt_flag = 1; } break; - case SC_CURSE: + case StatusChange::SC_CURSE: *opt2 |= Opt2::_curse; opt_flag = 1; break; - case SC_SILENCE: + case StatusChange::SC_SILENCE: *opt2 |= Opt2::_silence; opt_flag = 1; break; - case SC_BLIND: + case StatusChange::SC_BLIND: *opt2 |= Opt2::BLIND; opt_flag = 1; break; - case SC_SLOWPOISON: + case StatusChange::SC_SLOWPOISON: *opt2 &= ~Opt2::_poison; *opt2 |= Opt2::_slowpoison; opt_flag = 1; @@ -1457,10 +1450,10 @@ int skill_status_effect(struct block_list *bl, StatusChange type, add_timer(gettick() + tick, skill_status_change_timer, bl->id, custom_data_t(type)); - if (bl->type == BL_PC && calc_flag) + if (bl->type == BL::PC && calc_flag) pc_calcstatus(sd, 0); /* ステータス再計算 */ - if (bl->type == BL_PC && updateflag != SP::ZERO) + if (bl->type == BL::PC && updateflag != SP::ZERO) clif_updatestatus(sd, updateflag); /* ステータスをクライアントに送る */ return 0; @@ -1496,7 +1489,7 @@ int skill_status_change_clear(struct block_list *bl, int type) if (*sc_count == 0) return 0; - for (StatusChange i : erange(StatusChange(), MAX_STATUSCHANGE)) + for (StatusChange i : erange(StatusChange(), StatusChange::MAX_STATUSCHANGE)) { if (sc_data[i].timer != -1) { @@ -1551,17 +1544,17 @@ static SP scan_stat(char *statname) { if (!strcasecmp(statname, "str")) - return SP_STR; + return SP::STR; if (!strcasecmp(statname, "dex")) - return SP_DEX; + return SP::DEX; if (!strcasecmp(statname, "agi")) - return SP_AGI; + return SP::AGI; if (!strcasecmp(statname, "vit")) - return SP_VIT; + return SP::VIT; if (!strcasecmp(statname, "int")) - return SP_INT; + return SP::INT; if (!strcasecmp(statname, "luk")) - return SP_LUK; + return SP::LUK; if (!strcasecmp(statname, "none")) return SP::ZERO; @@ -1612,7 +1605,7 @@ int skill_readdb(void) } SkillID i = SkillID(atoi(split[0])); - if (/*i < SkillID() ||*/ i > MAX_SKILL_DB) + if (/*i < SkillID() ||*/ i > SkillID::MAX_SKILL_DB) continue; memset(split2, 0, sizeof(split2)); @@ -1652,19 +1645,19 @@ int skill_readdb(void) skill_db[i].cast_def_rate = atoi(split[10]); skill_db[i].inf2 = atoi(split[11]); skill_db[i].maxcount = atoi(split[12]); - // split[13] was one of: BF_WEAPON, BF_MAGIC, BF_MISC, BF::ZERO + // split[13] was one of: BF::WEAPON, BF::MAGIC, BF::MISC, BF::ZERO memset(split2, 0, sizeof(split2)); // split[14] was colon-separated blow counts. if (!strcasecmp(split[15], "passive")) { skill_pool_register(i); - skill_db[i].poolflags = SKILL_POOL_FLAG; + skill_db[i].poolflags = SkillFlags::POOL_FLAG; } else if (!strcasecmp(split[15], "active")) { skill_pool_register(i); - skill_db[i].poolflags = SKILL_POOL_FLAG | SKILL_POOL_ACTIVE; + skill_db[i].poolflags = SkillFlags::POOL_FLAG | SkillFlags::POOL_ACTIVE; } else skill_db[i].poolflags = SkillFlags::ZERO; |