The master and develop branches track hengband.
OS X development happens on the macos-1-6-2, macos-2-2-1, and macos-develop branches.
修訂 | 0e8f0e8e4f39297e076ae7fd1590bd5d1cee7479 (tree) |
---|---|
時間 | 2022-06-30 01:49:45 |
作者 | Eric Branlund <ebranlund@fast...> |
Commiter | Eric Branlund |
Merge branch 'develop' into macos-develop
@@ -600,6 +600,7 @@ | ||
600 | 600 | <ClCompile Include="..\..\src\target\target-getter.cpp" /> |
601 | 601 | <ClCompile Include="..\..\src\target\target-preparation.cpp" /> |
602 | 602 | <ClCompile Include="..\..\src\target\target-setter.cpp" /> |
603 | + <ClCompile Include="..\..\src\timed-effect\player-acceleration.cpp" /> | |
603 | 604 | <ClCompile Include="..\..\src\timed-effect\player-confusion.cpp" /> |
604 | 605 | <ClCompile Include="..\..\src\timed-effect\player-cut.cpp" /> |
605 | 606 | <ClCompile Include="..\..\src\timed-effect\player-fear.cpp" /> |
@@ -1394,6 +1395,7 @@ | ||
1394 | 1395 | <ClInclude Include="..\..\src\term\screen-processor.h" /> |
1395 | 1396 | <ClInclude Include="..\..\src\timed-effect\player-confusion.h" /> |
1396 | 1397 | <ClInclude Include="..\..\src\timed-effect\player-cut.h" /> |
1398 | + <ClInclude Include="..\..\src\timed-effect\player-acceleration.h" /> | |
1397 | 1399 | <ClInclude Include="..\..\src\timed-effect\player-fear.h" /> |
1398 | 1400 | <ClInclude Include="..\..\src\timed-effect\player-hallucination.h" /> |
1399 | 1401 | <ClInclude Include="..\..\src\timed-effect\player-paralysis.h" /> |
@@ -2454,6 +2454,9 @@ | ||
2454 | 2454 | <ClCompile Include="..\..\src\monster-race\race-feature-mask.cpp"> |
2455 | 2455 | <Filter>monster-race</Filter> |
2456 | 2456 | </ClCompile> |
2457 | + <ClCompile Include="..\..\src\timed-effect\player-acceleration.cpp"> | |
2458 | + <Filter>timed-effect</Filter> | |
2459 | + </ClCompile> | |
2457 | 2460 | </ItemGroup> |
2458 | 2461 | <ItemGroup> |
2459 | 2462 | <ClInclude Include="..\..\src\combat\shoot.h"> |
@@ -5331,6 +5334,9 @@ | ||
5331 | 5334 | <ClInclude Include="..\..\src\monster-race\race-feature-mask.h"> |
5332 | 5335 | <Filter>monster-race</Filter> |
5333 | 5336 | </ClInclude> |
5337 | + <ClInclude Include="..\..\src\timed-effect\player-acceleration.h"> | |
5338 | + <Filter>timed-effect</Filter> | |
5339 | + </ClInclude> | |
5334 | 5340 | </ItemGroup> |
5335 | 5341 | <ItemGroup> |
5336 | 5342 | <None Include="..\..\src\wall.bmp" /> |
@@ -939,6 +939,7 @@ hengband_SOURCES = \ | ||
939 | 939 | term/z-term.cpp term/z-term.h term/z-util.cpp term/z-util.h \ |
940 | 940 | term/z-virt.cpp term/z-virt.h \ |
941 | 941 | \ |
942 | + timed-effect/player-acceleration.cpp timed-effect/player-acceleration.h \ | |
942 | 943 | timed-effect/player-confusion.cpp timed-effect/player-confusion.h \ |
943 | 944 | timed-effect/player-cut.cpp timed-effect/player-cut.h \ |
944 | 945 | timed-effect/player-fear.cpp timed-effect/player-fear.h \ |
@@ -323,7 +323,7 @@ static bool switch_cast_blue_magic(PlayerType *player_ptr, bmc_type *bmc_ptr, Mo | ||
323 | 323 | case MonsterAbilityType::HOLD: |
324 | 324 | return cast_blue_sleep(player_ptr, bmc_ptr); |
325 | 325 | case MonsterAbilityType::HASTE: |
326 | - (void)set_fast(player_ptr, randint1(20 + bmc_ptr->plev) + bmc_ptr->plev, false); | |
326 | + (void)set_acceleration(player_ptr, randint1(20 + bmc_ptr->plev) + bmc_ptr->plev, false); | |
327 | 327 | return true; |
328 | 328 | case MonsterAbilityType::HAND_DOOM: |
329 | 329 | return cast_blue_hand_doom(player_ptr, bmc_ptr); |
@@ -895,7 +895,7 @@ static bool use_mane(PlayerType *player_ptr, MonsterAbilityType spell) | ||
895 | 895 | sleep_monster(player_ptr, dir, plev); |
896 | 896 | break; |
897 | 897 | case MonsterAbilityType::HASTE: |
898 | - (void)set_fast(player_ptr, randint1(20 + plev) + plev, false); | |
898 | + (void)set_acceleration(player_ptr, randint1(20 + plev) + plev, false); | |
899 | 899 | break; |
900 | 900 | case MonsterAbilityType::HAND_DOOM: { |
901 | 901 | if (!get_aim_dir(player_ptr, &dir)) { |
@@ -235,7 +235,7 @@ int staff_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use_ch | ||
235 | 235 | } |
236 | 236 | |
237 | 237 | case SV_STAFF_SPEED: { |
238 | - if (set_fast(player_ptr, randint1(30) + (powerful ? 30 : 15), false)) { | |
238 | + if (set_acceleration(player_ptr, randint1(30) + (powerful ? 30 : 15), false)) { | |
239 | 239 | ident = true; |
240 | 240 | } |
241 | 241 | break; |
@@ -143,7 +143,7 @@ int rod_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, | ||
143 | 143 | } |
144 | 144 | |
145 | 145 | case SV_ROD_SPEED: { |
146 | - if (set_fast(player_ptr, randint1(30) + (powerful ? 30 : 15), false)) { | |
146 | + if (set_acceleration(player_ptr, randint1(30) + (powerful ? 30 : 15), false)) { | |
147 | 147 | ident = true; |
148 | 148 | } |
149 | 149 | break; |
@@ -17,6 +17,7 @@ | ||
17 | 17 | #include "status/sight-setter.h" |
18 | 18 | #include "status/temporary-resistance.h" |
19 | 19 | #include "system/player-type-definition.h" |
20 | +#include "timed-effect/player-acceleration.h" | |
20 | 21 | #include "timed-effect/player-confusion.h" |
21 | 22 | #include "timed-effect/player-cut.h" |
22 | 23 | #include "timed-effect/player-fear.h" |
@@ -143,8 +144,8 @@ void reduce_magic_effects_timeout(PlayerType *player_ptr) | ||
143 | 144 | (void)bss.mod_fear(-1); |
144 | 145 | } |
145 | 146 | |
146 | - if (player_ptr->fast) { | |
147 | - (void)set_fast(player_ptr, player_ptr->fast - 1, true); | |
147 | + if (effects->acceleration()->is_fast()) { | |
148 | + (void)mod_acceleration(player_ptr, -1, true); | |
148 | 149 | } |
149 | 150 | |
150 | 151 | if (player_ptr->slow) { |
@@ -7,6 +7,7 @@ | ||
7 | 7 | #include "status/bad-status-setter.h" |
8 | 8 | #include "status/buff-setter.h" |
9 | 9 | #include "system/player-type-definition.h" |
10 | +#include "timed-effect/player-acceleration.h" | |
10 | 11 | #include "view/display-messages.h" |
11 | 12 | |
12 | 13 | void effect_player_old_heal(PlayerType *player_ptr, EffectPlayerType *ep_ptr) |
@@ -25,7 +26,7 @@ void effect_player_old_speed(PlayerType *player_ptr, EffectPlayerType *ep_ptr) | ||
25 | 26 | msg_print(_("何かで攻撃された!", "You are hit by something!")); |
26 | 27 | } |
27 | 28 | |
28 | - (void)set_fast(player_ptr, player_ptr->fast + randint1(5), false); | |
29 | + (void)mod_acceleration(player_ptr, randint1(5), false); | |
29 | 30 | ep_ptr->dam = 0; |
30 | 31 | } |
31 | 32 |
@@ -23,6 +23,7 @@ | ||
23 | 23 | #include "system/angband-exceptions.h" |
24 | 24 | #include "system/floor-type-definition.h" |
25 | 25 | #include "system/player-type-definition.h" |
26 | +#include "timed-effect/player-acceleration.h" | |
26 | 27 | #include "timed-effect/player-confusion.h" |
27 | 28 | #include "timed-effect/player-cut.h" |
28 | 29 | #include "timed-effect/player-fear.h" |
@@ -360,7 +361,7 @@ static void rd_energy(PlayerType *player_ptr) | ||
360 | 361 | static void rd_status(PlayerType *player_ptr) |
361 | 362 | { |
362 | 363 | auto effects = player_ptr->effects(); |
363 | - player_ptr->fast = rd_s16b(); | |
364 | + effects->acceleration()->set(rd_s16b()); | |
364 | 365 | player_ptr->slow = rd_s16b(); |
365 | 366 | effects->fear()->set(rd_s16b()); |
366 | 367 | effects->cut()->set(rd_s16b()); |
@@ -249,7 +249,7 @@ bool cast_mindcrafter_spell(PlayerType *player_ptr, MindMindcrafterType spell) | ||
249 | 249 | |
250 | 250 | t = 10 + randint1((plev * 3) / 2); |
251 | 251 | set_hero(player_ptr, t, false); |
252 | - (void)set_fast(player_ptr, t, false); | |
252 | + (void)set_acceleration(player_ptr, t, false); | |
253 | 253 | break; |
254 | 254 | } |
255 | 255 | case MindMindcrafterType::TELEKINESIS: |
@@ -29,6 +29,8 @@ | ||
29 | 29 | #include "system/monster-type-definition.h" |
30 | 30 | #include "system/object-type-definition.h" |
31 | 31 | #include "system/player-type-definition.h" |
32 | +#include "timed-effect/player-acceleration.h" | |
33 | +#include "timed-effect/timed-effects.h" | |
32 | 34 | #include "view/display-messages.h" |
33 | 35 | |
34 | 36 | /*! |
@@ -301,7 +303,7 @@ static void calc_blow_drain_mana(PlayerType *player_ptr, MonsterAttackPlayer *mo | ||
301 | 303 | |
302 | 304 | static void calc_blow_inertia(PlayerType *player_ptr, MonsterAttackPlayer *monap_ptr) |
303 | 305 | { |
304 | - if ((player_ptr->fast > 0) || (player_ptr->pspeed >= 130)) { | |
306 | + if (player_ptr->effects()->acceleration()->is_fast() || (player_ptr->pspeed >= 130)) { | |
305 | 307 | monap_ptr->damage = monap_ptr->damage * (randint1(4) + 4) / 9; |
306 | 308 | } |
307 | 309 |
@@ -36,7 +36,7 @@ | ||
36 | 36 | */ |
37 | 37 | static void dispel_player(PlayerType *player_ptr) |
38 | 38 | { |
39 | - (void)set_fast(player_ptr, 0, true); | |
39 | + (void)set_acceleration(player_ptr, 0, true); | |
40 | 40 | set_lightspeed(player_ptr, 0, true); |
41 | 41 | (void)BadStatusSetter(player_ptr).slowness(0, true); |
42 | 42 | (void)set_shield(player_ptr, 0, true); |
@@ -51,6 +51,7 @@ | ||
51 | 51 | #include "target/target-setter.h" |
52 | 52 | #include "target/target-types.h" |
53 | 53 | #include "term/screen-processor.h" |
54 | +#include "timed-effect/player-acceleration.h" | |
54 | 55 | #include "timed-effect/player-confusion.h" |
55 | 56 | #include "timed-effect/timed-effects.h" |
56 | 57 | #include "view/display-messages.h" |
@@ -234,8 +235,8 @@ void process_world_aux_mutation(PlayerType *player_ptr) | ||
234 | 235 | disturb(player_ptr, false, true); |
235 | 236 | if (one_in_(2)) { |
236 | 237 | msg_print(_("精力的でなくなった気がする。", "You feel less energetic.")); |
237 | - if (player_ptr->fast > 0) { | |
238 | - set_fast(player_ptr, 0, true); | |
238 | + if (player_ptr->effects()->acceleration()->is_fast()) { | |
239 | + set_acceleration(player_ptr, 0, true); | |
239 | 240 | } else { |
240 | 241 | (void)bss.slowness(randint1(30) + 10, false); |
241 | 242 | } |
@@ -244,7 +245,7 @@ void process_world_aux_mutation(PlayerType *player_ptr) | ||
244 | 245 | if (player_ptr->slow > 0) { |
245 | 246 | (void)bss.slowness(0, true); |
246 | 247 | } else { |
247 | - set_fast(player_ptr, randint1(30) + 10, false); | |
248 | + set_acceleration(player_ptr, randint1(30) + 10, false); | |
248 | 249 | } |
249 | 250 | } |
250 | 251 |
@@ -38,6 +38,7 @@ | ||
38 | 38 | #include "status/sight-setter.h" |
39 | 39 | #include "system/floor-type-definition.h" |
40 | 40 | #include "system/player-type-definition.h" |
41 | +#include "timed-effect/player-acceleration.h" | |
41 | 42 | #include "view/display-messages.h" |
42 | 43 | |
43 | 44 | bool switch_activation(PlayerType *player_ptr, ObjectType **o_ptr_ptr, const activation_type *const act_ptr, concptr name) |
@@ -242,15 +243,15 @@ bool switch_activation(PlayerType *player_ptr, ObjectType **o_ptr_ptr, const act | ||
242 | 243 | return activate_resistance_elements(player_ptr); |
243 | 244 | case RandomArtActType::SPEED: |
244 | 245 | msg_print(_("明るく緑色に輝いている...", "It glows bright green...")); |
245 | - (void)set_fast(player_ptr, randint1(20) + 20, false); | |
246 | + (void)set_acceleration(player_ptr, randint1(20) + 20, false); | |
246 | 247 | return true; |
247 | 248 | case RandomArtActType::MID_SPEED: |
248 | 249 | msg_print(_("明るく緑色に輝いている...", "It glows bright green...")); |
249 | - (void)set_fast(player_ptr, randint1(50) + 50, false); | |
250 | + (void)set_acceleration(player_ptr, randint1(50) + 50, false); | |
250 | 251 | return true; |
251 | 252 | case RandomArtActType::XTRA_SPEED: |
252 | 253 | msg_print(_("明るく輝いている...", "It glows brightly...")); |
253 | - (void)set_fast(player_ptr, randint1(75) + 75, false); | |
254 | + (void)set_acceleration(player_ptr, randint1(75) + 75, false); | |
254 | 255 | return true; |
255 | 256 | case RandomArtActType::WRAITH: |
256 | 257 | set_wraith_form(player_ptr, randint1(player_ptr->lev / 2) + (player_ptr->lev / 2), false); |
@@ -262,7 +263,7 @@ bool switch_activation(PlayerType *player_ptr, ObjectType **o_ptr_ptr, const act | ||
262 | 263 | (void)heroism(player_ptr, 25); |
263 | 264 | return true; |
264 | 265 | case RandomArtActType::HERO_SPEED: |
265 | - (void)set_fast(player_ptr, randint1(50) + 50, false); | |
266 | + (void)set_acceleration(player_ptr, randint1(50) + 50, false); | |
266 | 267 | (void)heroism(player_ptr, 50); |
267 | 268 | return true; |
268 | 269 | case RandomArtActType::ACID_BALL_AND_RESISTANCE: |
@@ -362,7 +363,7 @@ bool switch_activation(PlayerType *player_ptr, ObjectType **o_ptr_ptr, const act | ||
362 | 363 | case RandomArtActType::STRAIN_HASTE: |
363 | 364 | msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name); |
364 | 365 | take_hit(player_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste")); |
365 | - (void)set_fast(player_ptr, player_ptr->fast + 25 + randint1(25), false); | |
366 | + (void)mod_acceleration(player_ptr, 25 + randint1(25), false); | |
366 | 367 | return true; |
367 | 368 | case RandomArtActType::FISHING: |
368 | 369 | return fishing(player_ptr); |
@@ -37,6 +37,8 @@ | ||
37 | 37 | #include "system/angband.h" |
38 | 38 | #include "system/object-type-definition.h" |
39 | 39 | #include "system/player-type-definition.h" |
40 | +#include "timed-effect/player-acceleration.h" | |
41 | +#include "timed-effect/timed-effects.h" | |
40 | 42 | #include "util/bit-flags-calculator.h" |
41 | 43 | #include "view/display-messages.h" |
42 | 44 |
@@ -372,12 +374,12 @@ bool QuaffEffects::death() | ||
372 | 374 | */ |
373 | 375 | bool QuaffEffects::speed() |
374 | 376 | { |
375 | - if (this->player_ptr->fast) { | |
376 | - (void)set_fast(this->player_ptr, this->player_ptr->fast + 5, false); | |
377 | + if (this->player_ptr->effects()->acceleration()->is_fast()) { | |
378 | + (void)mod_acceleration(this->player_ptr, 5, false); | |
377 | 379 | return false; |
378 | 380 | } |
379 | 381 | |
380 | - return set_fast(this->player_ptr, randint1(25) + 15, false); | |
382 | + return set_acceleration(this->player_ptr, randint1(25) + 15, false); | |
381 | 383 | } |
382 | 384 | |
383 | 385 | /*! |
@@ -110,6 +110,7 @@ | ||
110 | 110 | #include "system/object-type-definition.h" |
111 | 111 | #include "system/player-type-definition.h" |
112 | 112 | #include "term/screen-processor.h" |
113 | +#include "timed-effect/player-acceleration.h" | |
113 | 114 | #include "timed-effect/player-stun.h" |
114 | 115 | #include "timed-effect/timed-effects.h" |
115 | 116 | #include "util/bit-flags-calculator.h" |
@@ -3154,7 +3155,7 @@ void stop_mouth(PlayerType *player_ptr) | ||
3154 | 3155 | |
3155 | 3156 | bool is_fast(PlayerType *player_ptr) |
3156 | 3157 | { |
3157 | - return player_ptr->fast || music_singing(player_ptr, MUSIC_SPEED) || music_singing(player_ptr, MUSIC_SHERO); | |
3158 | + return player_ptr->effects()->acceleration()->is_fast() || music_singing(player_ptr, MUSIC_SPEED) || music_singing(player_ptr, MUSIC_SHERO); | |
3158 | 3159 | } |
3159 | 3160 | |
3160 | 3161 | bool is_invuln(PlayerType *player_ptr) |
@@ -447,7 +447,7 @@ concptr do_craft_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessType | ||
447 | 447 | } |
448 | 448 | |
449 | 449 | if (cast) { |
450 | - set_fast(player_ptr, randint1(sides) + base, false); | |
450 | + set_acceleration(player_ptr, randint1(sides) + base, false); | |
451 | 451 | } |
452 | 452 | } |
453 | 453 | break; |
@@ -765,7 +765,7 @@ concptr do_crusade_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessTy | ||
765 | 765 | |
766 | 766 | set_hero(player_ptr, randint1(base) + base, false); |
767 | 767 | set_blessed(player_ptr, randint1(base) + base, false); |
768 | - set_fast(player_ptr, randint1(sp_sides) + sp_base, false); | |
768 | + set_acceleration(player_ptr, randint1(sp_sides) + sp_base, false); | |
769 | 769 | set_protevil(player_ptr, randint1(base) + base, false); |
770 | 770 | (void)BadStatusSetter(player_ptr).fear(0); |
771 | 771 | } |
@@ -563,7 +563,7 @@ concptr do_death_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessType | ||
563 | 563 | |
564 | 564 | if (cast) { |
565 | 565 | (void)berserk(player_ptr, b_base + randint1(b_base)); |
566 | - set_fast(player_ptr, randint1(sp_sides) + sp_base, false); | |
566 | + set_acceleration(player_ptr, randint1(sp_sides) + sp_base, false); | |
567 | 567 | } |
568 | 568 | } |
569 | 569 | break; |
@@ -662,7 +662,7 @@ concptr do_life_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessType | ||
662 | 662 | |
663 | 663 | if (cast) { |
664 | 664 | TIME_EFFECT v = randint1(base) + base; |
665 | - set_fast(player_ptr, v, false); | |
665 | + set_acceleration(player_ptr, v, false); | |
666 | 666 | set_oppose_acid(player_ptr, v, false); |
667 | 667 | set_oppose_elec(player_ptr, v, false); |
668 | 668 | set_oppose_fire(player_ptr, v, false); |
@@ -25,6 +25,8 @@ | ||
25 | 25 | #include "status/experience.h" |
26 | 26 | #include "system/player-type-definition.h" |
27 | 27 | #include "target/target-getter.h" |
28 | +#include "timed-effect/player-acceleration.h" | |
29 | +#include "timed-effect/timed-effects.h" | |
28 | 30 | #include "view/display-messages.h" |
29 | 31 | |
30 | 32 | /*! |
@@ -693,7 +695,7 @@ concptr do_music_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessType | ||
693 | 695 | } |
694 | 696 | |
695 | 697 | if (stop) { |
696 | - if (!player_ptr->fast) { | |
698 | + if (!player_ptr->effects()->acceleration()->is_fast()) { | |
697 | 699 | msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down.")); |
698 | 700 | } |
699 | 701 | } |
@@ -968,7 +970,7 @@ concptr do_music_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessType | ||
968 | 970 | player_ptr->update |= PU_HP; |
969 | 971 | } |
970 | 972 | |
971 | - if (!player_ptr->fast) { | |
973 | + if (!player_ptr->effects()->acceleration()->is_fast()) { | |
972 | 974 | msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down.")); |
973 | 975 | } |
974 | 976 | } |
@@ -351,7 +351,7 @@ concptr do_sorcery_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessTy | ||
351 | 351 | } |
352 | 352 | |
353 | 353 | if (cast) { |
354 | - set_fast(player_ptr, randint1(sides) + base, false); | |
354 | + set_acceleration(player_ptr, randint1(sides) + base, false); | |
355 | 355 | } |
356 | 356 | } |
357 | 357 | break; |
@@ -10,6 +10,7 @@ | ||
10 | 10 | #include "system/building-type-definition.h" |
11 | 11 | #include "system/floor-type-definition.h" |
12 | 12 | #include "system/player-type-definition.h" |
13 | +#include "timed-effect/player-acceleration.h" | |
13 | 14 | #include "timed-effect/player-confusion.h" |
14 | 15 | #include "timed-effect/player-cut.h" |
15 | 16 | #include "timed-effect/player-fear.h" |
@@ -164,7 +165,7 @@ void wr_player(PlayerType *player_ptr) | ||
164 | 165 | wr_s16b(0); /* old "protection" */ |
165 | 166 | wr_s16b(player_ptr->energy_need); |
166 | 167 | wr_s16b(player_ptr->enchant_energy_need); |
167 | - wr_s16b(player_ptr->fast); | |
168 | + wr_s16b(effects->acceleration()->current()); | |
168 | 169 | wr_s16b(player_ptr->slow); |
169 | 170 | wr_s16b(effects->fear()->current()); |
170 | 171 | wr_s16b(effects->cut()->current()); |
@@ -51,6 +51,7 @@ | ||
51 | 51 | #include "system/object-type-definition.h" |
52 | 52 | #include "system/player-type-definition.h" |
53 | 53 | #include "target/target-getter.h" |
54 | +#include "timed-effect/player-acceleration.h" | |
54 | 55 | #include "timed-effect/player-cut.h" |
55 | 56 | #include "timed-effect/timed-effects.h" |
56 | 57 | #include "util/bit-flags-calculator.h" |
@@ -598,7 +599,7 @@ bool cosmic_cast_off(PlayerType *player_ptr, ObjectType **o_ptr_ptr) | ||
598 | 599 | (void)set_tim_regen(player_ptr, player_ptr->tim_regen + t, false); |
599 | 600 | (void)set_hero(player_ptr, player_ptr->hero + t, false); |
600 | 601 | (void)set_blessed(player_ptr, player_ptr->blessed + t, false); |
601 | - (void)set_fast(player_ptr, player_ptr->fast + t, false); | |
602 | + (void)mod_acceleration(player_ptr, t, false); | |
602 | 603 | (void)set_shero(player_ptr, player_ptr->shero + t, false); |
603 | 604 | if (PlayerClass(player_ptr).equals(PlayerClassType::FORCETRAINER)) { |
604 | 605 | set_current_ki(player_ptr, true, player_ptr->lev * 5 + 190); |
@@ -19,6 +19,7 @@ | ||
19 | 19 | #include "status/buff-setter.h" |
20 | 20 | #include "status/element-resistance.h" |
21 | 21 | #include "system/player-type-definition.h" |
22 | +#include "timed-effect/player-acceleration.h" | |
22 | 23 | #include "timed-effect/player-confusion.h" |
23 | 24 | #include "timed-effect/player-cut.h" |
24 | 25 | #include "timed-effect/player-fear.h" |
@@ -34,7 +35,7 @@ | ||
34 | 35 | void reset_tim_flags(PlayerType *player_ptr) |
35 | 36 | { |
36 | 37 | auto effects = player_ptr->effects(); |
37 | - player_ptr->fast = 0; /* Timed -- Fast */ | |
38 | + effects->acceleration()->reset(); | |
38 | 39 | player_ptr->lightspeed = 0; |
39 | 40 | player_ptr->slow = 0; /* Timed -- Slow */ |
40 | 41 | player_ptr->blind = 0; /* Timed -- Blindness */ |
@@ -116,7 +117,7 @@ void reset_tim_flags(PlayerType *player_ptr) | ||
116 | 117 | * @param do_dec 現在の継続時間より長い値のみ上書きする |
117 | 118 | * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。 |
118 | 119 | */ |
119 | -bool set_fast(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec) | |
120 | +bool set_acceleration(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec) | |
120 | 121 | { |
121 | 122 | bool notice = false; |
122 | 123 | v = (v > 10000) ? 10000 : (v < 0) ? 0 |
@@ -126,9 +127,10 @@ bool set_fast(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec) | ||
126 | 127 | return false; |
127 | 128 | } |
128 | 129 | |
130 | + auto acceleration = player_ptr->effects()->acceleration(); | |
129 | 131 | if (v) { |
130 | - if (player_ptr->fast && !do_dec) { | |
131 | - if (player_ptr->fast > v) { | |
132 | + if (acceleration->is_fast() && !do_dec) { | |
133 | + if (acceleration->current() > v) { | |
132 | 134 | return false; |
133 | 135 | } |
134 | 136 | } else if (!is_fast(player_ptr) && !player_ptr->lightspeed) { |
@@ -138,13 +140,13 @@ bool set_fast(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec) | ||
138 | 140 | chg_virtue(player_ptr, V_DILIGENCE, 1); |
139 | 141 | } |
140 | 142 | } else { |
141 | - if (player_ptr->fast && !player_ptr->lightspeed && !music_singing(player_ptr, MUSIC_SPEED) && !music_singing(player_ptr, MUSIC_SHERO)) { | |
143 | + if (acceleration->is_fast() && !player_ptr->lightspeed && !music_singing(player_ptr, MUSIC_SPEED) && !music_singing(player_ptr, MUSIC_SHERO)) { | |
142 | 144 | msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down.")); |
143 | 145 | notice = true; |
144 | 146 | } |
145 | 147 | } |
146 | 148 | |
147 | - player_ptr->fast = v; | |
149 | + acceleration->set(v); | |
148 | 150 | if (!notice) { |
149 | 151 | return false; |
150 | 152 | } |
@@ -157,6 +159,11 @@ bool set_fast(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec) | ||
157 | 159 | return true; |
158 | 160 | } |
159 | 161 | |
162 | +bool mod_acceleration(PlayerType *player_ptr, const TIME_EFFECT v, const bool do_dec) | |
163 | +{ | |
164 | + return set_acceleration(player_ptr, player_ptr->effects()->acceleration()->current() + v, do_dec); | |
165 | +} | |
166 | + | |
160 | 167 | /*! |
161 | 168 | * @brief 肌石化の継続時間をセットする / Set "shield", notice observable changes |
162 | 169 | * @param v 継続時間 |
@@ -5,7 +5,8 @@ | ||
5 | 5 | enum class MimicKindType; |
6 | 6 | class PlayerType; |
7 | 7 | void reset_tim_flags(PlayerType *player_ptr); |
8 | -bool set_fast(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec); | |
8 | +bool set_acceleration(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec); | |
9 | +bool mod_acceleration(PlayerType *player_ptr, const TIME_EFFECT v, const bool do_dec); | |
9 | 10 | bool set_shield(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec); |
10 | 11 | bool set_magicdef(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec); |
11 | 12 | bool set_blessed(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec); |
@@ -94,7 +94,6 @@ public: | ||
94 | 94 | |
95 | 95 | uint32_t count{}; |
96 | 96 | |
97 | - TIME_EFFECT fast{}; /* Timed -- Fast */ | |
98 | 97 | TIME_EFFECT slow{}; /* Timed -- Slow */ |
99 | 98 | TIME_EFFECT blind{}; /* Timed -- Blindness */ |
100 | 99 | TIME_EFFECT poisoned{}; /* Timed -- Poisoned */ |
@@ -0,0 +1,26 @@ | ||
1 | +#include "timed-effect/player-acceleration.h" | |
2 | + | |
3 | +short PlayerAcceleration::current() const | |
4 | +{ | |
5 | + return this->acceleration; | |
6 | +} | |
7 | + | |
8 | +bool PlayerAcceleration::is_fast() const | |
9 | +{ | |
10 | + return this->acceleration > 0; | |
11 | +} | |
12 | + | |
13 | +void PlayerAcceleration::set(short value) | |
14 | +{ | |
15 | + this->acceleration = value; | |
16 | +} | |
17 | + | |
18 | +void PlayerAcceleration::add(short value) | |
19 | +{ | |
20 | + this->acceleration += value; | |
21 | +} | |
22 | + | |
23 | +void PlayerAcceleration::reset() | |
24 | +{ | |
25 | + this->set(0); | |
26 | +} |
@@ -0,0 +1,15 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | +class PlayerAcceleration { | |
4 | +public: | |
5 | + PlayerAcceleration() = default; | |
6 | + | |
7 | + short current() const; | |
8 | + bool is_fast() const; | |
9 | + void set(short value); | |
10 | + void add(short value); /*!< 減産も負値を引数に入れれば可能 */ | |
11 | + void reset(); | |
12 | + | |
13 | +private: | |
14 | + short acceleration = 0; | |
15 | +}; |
@@ -1,4 +1,5 @@ | ||
1 | 1 | #include "timed-effect/timed-effects.h" |
2 | +#include "timed-effect/player-acceleration.h" | |
2 | 3 | #include "timed-effect/player-confusion.h" |
3 | 4 | #include "timed-effect/player-cut.h" |
4 | 5 | #include "timed-effect/player-fear.h" |
@@ -13,6 +14,7 @@ TimedEffects::TimedEffects() | ||
13 | 14 | , player_hallucination(std::make_shared<PlayerHallucination>()) |
14 | 15 | , player_paralysis(std::make_shared<PlayerParalysis>()) |
15 | 16 | , player_stun(std::make_shared<PlayerStun>()) |
17 | + , player_acceleration(std::make_shared<PlayerAcceleration>()) | |
16 | 18 | { |
17 | 19 | } |
18 | 20 |
@@ -45,3 +47,8 @@ std::shared_ptr<PlayerStun> TimedEffects::stun() const | ||
45 | 47 | { |
46 | 48 | return this->player_stun; |
47 | 49 | } |
50 | + | |
51 | +std::shared_ptr<PlayerAcceleration> TimedEffects::acceleration() const | |
52 | +{ | |
53 | + return this->player_acceleration; | |
54 | +} |
@@ -2,6 +2,7 @@ | ||
2 | 2 | |
3 | 3 | #include <memory> |
4 | 4 | |
5 | +class PlayerAcceleration; | |
5 | 6 | class PlayerConfusion; |
6 | 7 | class PlayerFear; |
7 | 8 | class PlayerHallucination; |
@@ -19,6 +20,7 @@ public: | ||
19 | 20 | std::shared_ptr<PlayerHallucination> hallucination() const; |
20 | 21 | std::shared_ptr<PlayerParalysis> paralysis() const; |
21 | 22 | std::shared_ptr<PlayerStun> stun() const; |
23 | + std::shared_ptr<PlayerAcceleration> acceleration() const; | |
22 | 24 | |
23 | 25 | private: |
24 | 26 | std::shared_ptr<PlayerConfusion> player_confusion; |
@@ -27,4 +29,5 @@ private: | ||
27 | 29 | std::shared_ptr<PlayerHallucination> player_hallucination; |
28 | 30 | std::shared_ptr<PlayerParalysis> player_paralysis; |
29 | 31 | std::shared_ptr<PlayerStun> player_stun; |
32 | + std::shared_ptr<PlayerAcceleration> player_acceleration; | |
30 | 33 | }; |