From: Hourier Date: Wed, 1 Jul 2020 11:47:44 +0000 (+0900) Subject: [Refactor] #40466 Moved hp_player() from player-effects.c/h to hp-mp-processor.c/h X-Git-Tag: vmacos3.0.0-alpha52~782^2~547 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a7871c209b1478de0c5df0ef81b462fed8d1aee2;p=hengbandforosx%2Fhengbandosx.git [Refactor] #40466 Moved hp_player() from player-effects.c/h to hp-mp-processor.c/h --- diff --git a/src/cmd-action/cmd-mane.c b/src/cmd-action/cmd-mane.c index 46f595068..aa4758943 100644 --- a/src/cmd-action/cmd-mane.c +++ b/src/cmd-action/cmd-mane.c @@ -12,6 +12,7 @@ #include "cmd-action/cmd-spell.h" #include "cmd/cmd-basic.h" #include "core/asking-player.h" +#include "core/hp-mp-processor.h" #include "core/stuff-handler.h" #include "floor/floor.h" #include "game-option/disturbance-options.h" @@ -32,10 +33,6 @@ #include "monster/monster-status.h" #include "mspell/monster-power-table.h" #include "mspell/mspell-type.h" -#include "status/bad-status-setter.h" -#include "status/body-improvement.h" -#include "status/buff-setter.h" -#include "player/player-effects.h" #include "player/player-status.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-lite.h" @@ -45,6 +42,9 @@ #include "spell/spells-summon.h" #include "spell-kind/spells-teleport.h" #include "spell/spell-types.h" +#include "status/bad-status-setter.h" +#include "status/body-improvement.h" +#include "status/buff-setter.h" #include "term/screen-processor.h" #include "util/int-char-converter.h" #include "view/display-messages.h" diff --git a/src/cmd-item/cmd-activate.c b/src/cmd-item/cmd-activate.c index 399899fdc..badf554f6 100644 --- a/src/cmd-item/cmd-activate.c +++ b/src/cmd-item/cmd-activate.c @@ -12,6 +12,7 @@ #include "cmd-io/cmd-save.h" #include "cmd/cmd-basic.h" #include "core/asking-player.h" +#include "core/hp-mp-processor.h" #include "util/sort.h" #include "effect/effect-characteristics.h" #include "effect/spells-effect-util.h" diff --git a/src/cmd-item/cmd-eat.c b/src/cmd-item/cmd-eat.c index a4952fe7c..b9b46f9ff 100644 --- a/src/cmd-item/cmd-eat.c +++ b/src/cmd-item/cmd-eat.c @@ -5,6 +5,7 @@ */ #include "cmd-item/cmd-eat.h" +#include "core/hp-mp-processor.h" #include "floor/floor-object.h" #include "floor/floor.h" #include "inventory/inventory-object.h" @@ -23,7 +24,6 @@ #include "object/object-info.h" #include "perception/object-perception.h" #include "player/avatar.h" -#include "status/bad-status-setter.h" #include "player/digestion-processor.h" #include "player/mimic-info-table.h" #include "player/player-class.h" @@ -33,6 +33,7 @@ #include "player/special-defense-types.h" #include "spell-realm/spells-hex.h" #include "spell/spells-status.h" +#include "status/bad-status-setter.h" #include "status/base-status.h" #include "status/element-resistance.h" #include "status/experience.h" diff --git a/src/core/hp-mp-processor.c b/src/core/hp-mp-processor.c index 3d6d868a3..6fea07b85 100644 --- a/src/core/hp-mp-processor.c +++ b/src/core/hp-mp-processor.c @@ -11,6 +11,7 @@ #include "object-enchant/object-ego.h" #include "object-enchant/trc-types.h" #include "object/object-flavor.h" +#include "player/avatar.h" #include "player/player-damage.h" #include "player/player-race-types.h" #include "player/player-race.h" @@ -396,3 +397,46 @@ void process_player_hp_mp(player_type *creature_ptr) regenhp(creature_ptr, regen_amount); } } + +/* + * Increase players hit points, notice effects + */ +bool hp_player(player_type *creature_ptr, int num) +{ + int vir; + vir = virtue_number(creature_ptr, V_VITALITY); + + if (num <= 0) + return FALSE; + + if (vir) { + num = num * (creature_ptr->virtues[vir - 1] + 1250) / 1250; + } + + if (creature_ptr->chp < creature_ptr->mhp) { + if ((num > 0) && (creature_ptr->chp < (creature_ptr->mhp / 3))) + chg_virtue(creature_ptr, V_TEMPERANCE, 1); + + creature_ptr->chp += num; + if (creature_ptr->chp >= creature_ptr->mhp) { + creature_ptr->chp = creature_ptr->mhp; + creature_ptr->chp_frac = 0; + } + + creature_ptr->redraw |= (PR_HP); + creature_ptr->window |= (PW_PLAYER); + if (num < 5) { + msg_print(_("少し気分が良くなった。", "You feel a little better.")); + } else if (num < 15) { + msg_print(_("気分が良くなった。", "You feel better.")); + } else if (num < 35) { + msg_print(_("とても気分が良くなった。", "You feel much better.")); + } else { + msg_print(_("ひじょうに気分が良くなった。", "You feel very good.")); + } + + return TRUE; + } + + return FALSE; +} diff --git a/src/core/hp-mp-processor.h b/src/core/hp-mp-processor.h index 297901bd1..9efd21447 100644 --- a/src/core/hp-mp-processor.h +++ b/src/core/hp-mp-processor.h @@ -3,3 +3,4 @@ #include "system/angband.h" void process_player_hp_mp(player_type* creature_ptr); +bool hp_player(player_type *creature_ptr, int num); diff --git a/src/effect/effect-monster-spirit.c b/src/effect/effect-monster-spirit.c index 5bc66fb3e..83a1cb234 100644 --- a/src/effect/effect-monster-spirit.c +++ b/src/effect/effect-monster-spirit.c @@ -1,4 +1,5 @@ #include "effect/effect-monster-spirit.h" +#include "core/hp-mp-processor.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags1.h" #include "monster-race/race-flags2.h" @@ -10,7 +11,6 @@ #include "monster/monster-status.h" #include "monster/monster-info.h" #include "mspell/mspell-mask-definitions.h" -#include "player/player-effects.h" #include "view/display-messages.h" gf_switch_result effect_monster_drain_mana(player_type *caster_ptr, effect_monster_type *em_ptr) diff --git a/src/effect/effect-player-oldies.c b/src/effect/effect-player-oldies.c index 417860e46..1ccca7af2 100644 --- a/src/effect/effect-player-oldies.c +++ b/src/effect/effect-player-oldies.c @@ -1,10 +1,10 @@ #include "effect/effect-player-oldies.h" +#include "core/hp-mp-processor.h" #include "game-option/birth-options.h" #include "monster-race/race-indice-types.h" +#include "player/eldritch-horror.h" #include "status/bad-status-setter.h" #include "status/buff-setter.h" -#include "player/eldritch-horror.h" -#include "player/player-effects.h" #include "view/display-messages.h" void effect_player_old_heal(player_type *target_ptr, effect_player_type *ep_ptr) diff --git a/src/effect/effect-player-resist-hurt.c b/src/effect/effect-player-resist-hurt.c index 40034cebe..bceb9b785 100644 --- a/src/effect/effect-player-resist-hurt.c +++ b/src/effect/effect-player-resist-hurt.c @@ -1,12 +1,12 @@ #include "effect/effect-player-resist-hurt.h" #include "art-definition/art-sword-types.h" +#include "core/hp-mp-processor.h" #include "inventory/inventory-damage.h" #include "mind/mind-mirror-master.h" #include "monster-race/race-indice-types.h" #include "mspell/mspells3.h" #include "mutation/mutation.h" #include "object/object-broken.h" -#include "status/bad-status-setter.h" #include "player/player-damage.h" #include "player/player-effects.h" #include "player/player-race-types.h" @@ -14,6 +14,7 @@ #include "spell-kind/spells-teleport.h" #include "spell/spells-status.h" #include "spell/spells3.h" +#include "status/bad-status-setter.h" #include "status/base-status.h" #include "status/element-resistance.h" #include "status/experience.h" diff --git a/src/mind/mind-warrior-mage.c b/src/mind/mind-warrior-mage.c index fa0f63153..ea119156c 100644 --- a/src/mind/mind-warrior-mage.c +++ b/src/mind/mind-warrior-mage.c @@ -1,6 +1,6 @@ #include "mind/mind-warrior-mage.h" +#include "core/hp-mp-processor.h" #include "player/player-damage.h" -#include "player/player-effects.h" #include "view/display-messages.h" bool comvert_hp_to_mp(player_type *creature_ptr) diff --git a/src/mind/mind.c b/src/mind/mind.c index bc5a563ca..eb8c83f9e 100644 --- a/src/mind/mind.c +++ b/src/mind/mind.c @@ -19,6 +19,7 @@ #include "cmd-action/cmd-spell.h" #include "cmd/cmd-basic.h" #include "core/asking-player.h" +#include "core/hp-mp-processor.h" #include "core/stuff-handler.h" #include "effect/effect-characteristics.h" #include "effect/spells-effect-util.h" @@ -45,7 +46,6 @@ #include "player/avatar.h" #include "player/player-class.h" #include "player/player-damage.h" -#include "player/player-effects.h" #include "player/player-move.h" #include "player/special-defense-types.h" #include "spell/process-effect.h" diff --git a/src/mind/racial-vampire.c b/src/mind/racial-vampire.c index 9ccb4da4c..595b924b4 100644 --- a/src/mind/racial-vampire.c +++ b/src/mind/racial-vampire.c @@ -1,10 +1,10 @@ #include "mind/racial-vampire.h" +#include "core/hp-mp-processor.h" #include "dungeon/dungeon.h" #include "floor/floor.h" #include "grid/grid.h" #include "io/targeting.h" #include "player/digestion-processor.h" -#include "player/player-effects.h" #include "spell-kind/spells-specific-bolt.h" #include "view/display-messages.h" diff --git a/src/mspell/mspells3.c b/src/mspell/mspells3.c index 54683efc9..157760f91 100644 --- a/src/mspell/mspells3.c +++ b/src/mspell/mspells3.c @@ -13,6 +13,7 @@ #include "cmd-action/cmd-spell.h" #include "cmd/cmd-basic.h" #include "core/asking-player.h" +#include "core/hp-mp-processor.h" #include "core/stuff-handler.h" #include "floor/floor.h" #include "game-option/disturbance-options.h" @@ -43,7 +44,6 @@ #include "mspell/mspell-mask-definitions.h" #include "mspell/mspell-type.h" #include "player/avatar.h" -#include "player/player-effects.h" #include "player/player-status.h" #include "realm/realm-types.h" #include "spell-kind/spells-launcher.h" diff --git a/src/mutation/mutation-processor.c b/src/mutation/mutation-processor.c index 254be86fc..21f9ab61c 100644 --- a/src/mutation/mutation-processor.c +++ b/src/mutation/mutation-processor.c @@ -1,4 +1,5 @@ #include "mutation/mutation-processor.h" +#include "core/hp-mp-processor.h" #include "grid/grid.h" #include "inventory/inventory-object.h" #include "io/targeting.h" diff --git a/src/player-attack/blood-sucking-processor.c b/src/player-attack/blood-sucking-processor.c index 0b9d8dad5..57a915395 100644 --- a/src/player-attack/blood-sucking-processor.c +++ b/src/player-attack/blood-sucking-processor.c @@ -6,10 +6,10 @@ #include "player-attack/blood-sucking-processor.h" #include "art-definition/art-sword-types.h" +#include "core/hp-mp-processor.h" #include "game-option/cheat-options.h" #include "monster-race/monster-race-hook.h" #include "object-enchant/tr-types.h" -#include "player/player-effects.h" #include "realm/realm-hex-numbers.h" #include "spell-realm/spells-hex.h" #include "util/bit-flags-calculator.h" diff --git a/src/player/player-effects.c b/src/player/player-effects.c index 2417a019a..7ce6778d4 100644 --- a/src/player/player-effects.c +++ b/src/player/player-effects.c @@ -18,6 +18,7 @@ #include "birth/character-builder.h" #include "cmd-building/cmd-building.h" #include "cmd-io/cmd-dump.h" +#include "core/hp-mp-processor.h" #include "core/speed-table.h" #include "core/stuff-handler.h" #include "dungeon/quest.h" @@ -240,49 +241,6 @@ void dispel_player(player_type *creature_ptr) } } -/* - * Increase players hit points, notice effects - */ -bool hp_player(player_type *creature_ptr, int num) -{ - int vir; - vir = virtue_number(creature_ptr, V_VITALITY); - - if (num <= 0) - return FALSE; - - if (vir) { - num = num * (creature_ptr->virtues[vir - 1] + 1250) / 1250; - } - - if (creature_ptr->chp < creature_ptr->mhp) { - if ((num > 0) && (creature_ptr->chp < (creature_ptr->mhp / 3))) - chg_virtue(creature_ptr, V_TEMPERANCE, 1); - - creature_ptr->chp += num; - if (creature_ptr->chp >= creature_ptr->mhp) { - creature_ptr->chp = creature_ptr->mhp; - creature_ptr->chp_frac = 0; - } - - creature_ptr->redraw |= (PR_HP); - creature_ptr->window |= (PW_PLAYER); - if (num < 5) { - msg_print(_("少し気分が良くなった。", "You feel a little better.")); - } else if (num < 15) { - msg_print(_("気分が良くなった。", "You feel better.")); - } else if (num < 35) { - msg_print(_("とても気分が良くなった。", "You feel much better.")); - } else { - msg_print(_("ひじょうに気分が良くなった。", "You feel very good.")); - } - - return TRUE; - } - - return FALSE; -} - void do_poly_wounds(player_type *creature_ptr) { s16b wounds = creature_ptr->cut; diff --git a/src/player/player-effects.h b/src/player/player-effects.h index 6daafb294..ff3387175 100644 --- a/src/player/player-effects.h +++ b/src/player/player-effects.h @@ -4,7 +4,6 @@ void set_action(player_type *creature_ptr, ACTION_IDX typ); void dispel_player(player_type *creature_ptr); -bool hp_player(player_type *creature_ptr, int num); void do_poly_self(player_type *creature_ptr); void do_poly_wounds(player_type *creature_ptr); void change_race(player_type *creature_ptr, player_race_type new_race, concptr effect_msg); diff --git a/src/realm/realm-crusade.c b/src/realm/realm-crusade.c index 45595a478..01994bbac 100644 --- a/src/realm/realm-crusade.c +++ b/src/realm/realm-crusade.c @@ -1,5 +1,6 @@ #include "realm/realm-crusade.h" #include "cmd-action/cmd-spell.h" +#include "core/hp-mp-processor.h" #include "effect/effect-characteristics.h" #include "floor/floor.h" #include "io/targeting.h" @@ -8,7 +9,6 @@ #include "status/bad-status-setter.h" #include "status/buff-setter.h" #include "player/player-class.h" -#include "player/player-effects.h" #include "spell-kind/spells-beam.h" #include "spell-kind/spells-curse-removal.h" #include "spell-kind/spells-detection.h" diff --git a/src/realm/realm-death.c b/src/realm/realm-death.c index ad041134e..85f35406f 100644 --- a/src/realm/realm-death.c +++ b/src/realm/realm-death.c @@ -1,12 +1,12 @@ #include "realm/realm-death.h" #include "cmd-action/cmd-spell.h" +#include "core/hp-mp-processor.h" #include "effect/effect-characteristics.h" #include "io/targeting.h" #include "player/avatar.h" #include "player/digestion-processor.h" #include "player/player-class.h" #include "player/player-damage.h" -#include "player/player-effects.h" #include "player/player-race.h" #include "spell-kind/spells-charm.h" #include "spell-kind/spells-detection.h" diff --git a/src/realm/realm-nature.c b/src/realm/realm-nature.c index 1eecd7eed..2f766e18f 100644 --- a/src/realm/realm-nature.c +++ b/src/realm/realm-nature.c @@ -1,5 +1,6 @@ #include "realm/realm-nature.h" #include "cmd-action/cmd-spell.h" +#include "core/hp-mp-processor.h" #include "effect/effect-characteristics.h" #include "effect/spells-effect-util.h" #include "floor/floor-object.h" @@ -10,7 +11,6 @@ #include "object/object-kind-hook.h" #include "player/avatar.h" #include "player/player-damage.h" -#include "player/player-effects.h" #include "player/player-race-types.h" #include "player/player-race.h" #include "spell-kind/earthquake.h" diff --git a/src/realm/realm-song.c b/src/realm/realm-song.c index 884a6246b..36dea6537 100644 --- a/src/realm/realm-song.c +++ b/src/realm/realm-song.c @@ -1,4 +1,5 @@ #include "cmd-action/cmd-spell.h" +#include "core/hp-mp-processor.h" #include "effect/effect-characteristics.h" #include "io/targeting.h" #include "status/bad-status-setter.h" diff --git a/src/spell-kind/spells-random.c b/src/spell-kind/spells-random.c index 166be76a4..d59ea5ab5 100644 --- a/src/spell-kind/spells-random.c +++ b/src/spell-kind/spells-random.c @@ -5,6 +5,7 @@ */ #include "spell-kind/spells-random.h" +#include "core/hp-mp-processor.h" #include "effect/effect-characteristics.h" #include "floor/floor.h" #include "io/targeting.h" @@ -16,7 +17,6 @@ #include "player/avatar.h" #include "status/bad-status-setter.h" #include "player/player-damage.h" -#include "player/player-effects.h" #include "spell-kind/earthquake.h" #include "spell-kind/spells-floor.h" #include "spell-kind/spells-genocide.h" diff --git a/src/spell/spells-staff-only.c b/src/spell/spells-staff-only.c index aae5f44d4..1e68ce292 100644 --- a/src/spell/spells-staff-only.c +++ b/src/spell/spells-staff-only.c @@ -1,11 +1,11 @@ #include "spell/spells-staff-only.h" +#include "core/hp-mp-processor.h" #include "effect/effect-characteristics.h" -#include "status/bad-status-setter.h" #include "player/player-damage.h" -#include "player/player-effects.h" #include "spell/process-effect.h" #include "spell-kind/spells-sight.h" #include "spell/spell-types.h" +#include "status/bad-status-setter.h" #include "status/body-improvement.h" #include "view/display-messages.h" diff --git a/src/spell/spells-status.c b/src/spell/spells-status.c index b38a740e4..e15993adc 100644 --- a/src/spell/spells-status.c +++ b/src/spell/spells-status.c @@ -7,6 +7,7 @@ #include "spell/spells-status.h" #include "cmd-action/cmd-spell.h" #include "cmd-item/cmd-magiceat.h" +#include "core/hp-mp-processor.h" #include "core/stuff-handler.h" #include "effect/effect-characteristics.h" #include "floor/floor-object.h" @@ -21,16 +22,16 @@ #include "object/object-kind-hook.h" #include "object/object-kind.h" #include "player/avatar.h" -#include "status/bad-status-setter.h" -#include "status/buff-setter.h" #include "player/player-class.h" #include "player/player-effects.h" #include "player/player-status.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-teleport.h" #include "spell/spell-types.h" +#include "status/bad-status-setter.h" #include "status/base-status.h" #include "status/body-improvement.h" +#include "status/buff-setter.h" #include "status/experience.h" #include "status/form-changer.h" #include "status/sight-setter.h" diff --git a/src/spell/spells-summon.c b/src/spell/spells-summon.c index 99cdc1994..1084a2a25 100644 --- a/src/spell/spells-summon.c +++ b/src/spell/spells-summon.c @@ -1,4 +1,5 @@ #include "spell/spells-summon.h" +#include "core/hp-mp-processor.h" #include "effect/spells-effect-util.h" #include "floor/floor.h" #include "game-option/birth-options.h" @@ -14,8 +15,6 @@ #include "object/item-use-flags.h" #include "object/item-tester-hooker.h" #include "player/avatar.h" -#include "status/bad-status-setter.h" -#include "player/player-effects.h" #include "spell/spells-diceroll.h" #include "spell-kind/earthquake.h" #include "spell-kind/spells-floor.h" @@ -26,6 +25,7 @@ #include "spell-kind/spells-specific-bolt.h" #include "spell/spells-status.h" #include "spell/spell-types.h" +#include "status/bad-status-setter.h" #include "sv-definition/sv-other-types.h" #include "util/string-processor.h" #include "view/display-messages.h"