forked from twig33/ynoclient
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgame_battlealgorithm.h
1033 lines (826 loc) · 26.9 KB
/
game_battlealgorithm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Player is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EP_GAME_BATTLEALGORITHM_H
#define EP_GAME_BATTLEALGORITHM_H
#include <string>
#include <vector>
#include <bitset>
#include <lcf/rpg/fwd.h>
#include <lcf/rpg/state.h>
#include "string_view.h"
#include "game_battler.h"
class Game_Battler;
class Game_Party_Base;
/**
* Contains algorithms to handle the different battle attacks, skills and items.
* The algorithms support single targets and party targets.
* For party targets the caller is responsible for retargeting using TargetNext.
*
* The action is simulated using Execute and the results can be applied after the
* simulation by calling Apply.
*/
namespace Game_BattleAlgorithm {
enum class Type {
None,
Normal,
Skill,
Item,
Defend,
Observe,
Charge,
SelfDestruct,
Escape,
Transform,
DoNothing,
};
struct StateEffect {
enum Effect : int16_t {
None,
Inflicted,
AlreadyInflicted,
Healed,
HealedByAttack
};
int16_t state_id = 0;
Effect effect = None;
StateEffect() = default;
StateEffect(int state_id, Effect effect)
: state_id(state_id), effect(effect) {}
};
struct AttributeEffect {
int16_t attr_id = 0;
int16_t shift = 0;
AttributeEffect() = default;
AttributeEffect(int id, int shift)
: attr_id(id), shift(shift) {}
};
class AlgorithmBase {
public:
virtual ~AlgorithmBase() {}
/** @return the source of the battle action. */
Game_Battler* GetSource() const;
/** @return current target battler */
Game_Battler* GetTarget() const;
/** @return If the action was reflected, returns the target which triggered the reflect */
Game_Battler* GetReflectTarget() const;
/** @return true if this algorithm targets a party */
Game_Party_Base* GetOriginalPartyTarget() const;
/** @return the original targets of the action before reflect or other modifications */
Span<Game_Battler* const> GetOriginalTargets() const;
/** @return If the action originally had a single target, return that target. Otherwise return nullptr */
Game_Battler* GetOriginalSingleTarget() const;
/** @return the current repetition of the algorithm */
int GetCurrentRepeat() const;
/** @return the total number of times this algo will repeat */
int GetTotalRepetitions() const;
/** Initializes targetting and performs any initial actions such as sp cost reduction for the user. */
void Start();
/**
* If IsReflected(target) true on any target, will reflect the action back on the source or the source's party.
*
* @return true if this algo was reflected.
*/
bool ReflectTargets();
/**
* Add a new target to the algo.
*
* @param target the target to add
* @param set_current Whether or not to reset the current target to this one
*/
void AddTarget(Game_Battler* target, bool set_current);
/**
* Add all party targets to the algo.
*
* @param targets the party to add
* @param set_current Whether or not to reset the current target to the first member of the party
*/
void AddTargets(Game_Party_Base* party, bool set_current);
/**
* Changes the target reference to the next target.
* When reaches the last target, will return false and reset back to first target.
*
* @return true if there was a next target available.
*/
bool TargetNext();
/**
* Performs the next repeated action.
*
* @param require_valid_target only repeat if current target is valid.
* @return true if the action should be repeated. Once false is returned, the repetition resets.
*/
bool RepeatNext(bool require_valid_target);
/**
* Defines switches that will be switched on after the action is finished.
* Multiple calls to this function will add additional switches to the list.
*
* @param switch_id Switch to turn on
*/
void SetSwitchEnable(int switch_id);
/**
* Defines switches that will be switched off after the action is finished.
* Multiple calls to this function will add additional switches to the list.
*
* @param switch_id Switch to turn off
*/
void SetSwitchDisable(int switch_id);
/** @return activated switch id or 0 when algorithm didn't affect a switch */
int GetAffectedSwitch() const;
/** @return true if this action affects hp. */
bool IsAffectHp() const;
/** @return true if this action absorbs hp. */
bool IsAbsorbHp() const;
/** @return true if this action affects sp. */
bool IsAffectSp() const;
/** @return true if this action absorbs sp. */
bool IsAbsorbSp() const;
/** @return true if this action affects atk. */
bool IsAffectAtk() const;
/** @return true if this action absorbs atk. */
bool IsAbsorbAtk() const;
/** @return true if this action affects def. */
bool IsAffectDef() const;
/** @return true if this action absorbs def. */
bool IsAbsorbDef() const;
/** @return true if this action affects spi. */
bool IsAffectSpi() const;
/** @return true if this action absorbs spi. */
bool IsAbsorbSpi() const;
/** @return true if this action affects agi. */
bool IsAffectAgi() const;
/** @return true if this action affects agi. */
bool IsAbsorbAgi() const;
/** @return signed value of how much hp is to be gained or lost */
int GetAffectedHp() const;
/** @return signed value of how much sp is to be gained or lost */
int GetAffectedSp() const;
/** @return signed value of how much attack is to be gained or lost */
int GetAffectedAtk() const;
/** @return signed value of how much defense is to be gained or lost */
int GetAffectedDef() const;
/** @return signed value of how much spirit is to be gained or lost */
int GetAffectedSpi() const;
/** @return signed value of how much agility is to be gained or lost */
int GetAffectedAgi() const;
/** @return all states changes caused by this action in order. */
const std::vector<StateEffect>& GetStateEffects() const;
/** @return all attributes which are shifited by this action. */
const std::vector<AttributeEffect>& GetShiftedAttributes() const;
/**
* Returns whether the action hit the target.
* This function returns the same as the last Execute-call.
*
* @return if the action hit the target
*/
bool IsSuccess() const;
/** @return Whether action was positive (e.g. healing) instead of damage. */
bool IsPositive() const;
/** @return Whether target will be revived from death */
bool IsRevived() const;
/** @return if the last action was a critical hit. */
bool IsCriticalHit() const;
/**
* Gets the Battle Animation that is assigned to the Algorithm
*
* @param i Which animation to fetch, starting from 0.
* @return Battle Animation id or 0 if no animation is assigned
*/
virtual int GetAnimationId(int i) const;
/**
* Plays the battle animation on all valid targets starting from the current target to the last target.
* Takes care of single and multi-target animations.
*
* @param anim_id the ID of the animation to play.
* @param sound_only Only play sounds
* @param cutoff If >= 0 maximum number of frames to play
* @param invert Flips the animation
* @return the number of frames the animation will play
*/
int PlayAnimation(int anim_id, bool sound_only = false, int cutoff = -1, bool invert = false);
/**
* Executes the algorithm. Must be called before using the other functions.
* This function only simulates the Algorithm, call Apply to add the
* changes of the last Execute call to the target.
*
* @return true if the action was successful, false if failed/dodged
*/
bool Execute();
/** Apply custom effects */
virtual void ApplyCustomEffect();
/**
* Apply switch enabled by action
* @return the switch id enabled, or 0 if none.
*/
int ApplySwitchEffect();
/**
* Apply hp damage or healing.
* @note Hp healing is not applied if the action revivies
* @return the amount of hp changed.
*/
int ApplyHpEffect();
/**
* Apply sp increase or decrease.
* @return the amount of sp changed.
*/
int ApplySpEffect();
/**
* Apply atk increase or decrease.
* @return the amount of atk changed.
*/
int ApplyAtkEffect();
/**
* Apply def increase or decrease.
* @return the amount of def changed.
*/
int ApplyDefEffect();
/**
* Apply spi increase or decrease.
* @return the amount of spi changed.
*/
int ApplySpiEffect();
/**
* Apply agi increase or decrease.
* @return the amount of agi changed.
*/
int ApplyAgiEffect();
/**
* Apply the given state effect.
* @return true if state was successfully added or removed.
*/
bool ApplyStateEffect(StateEffect se);
/** Apply all state effects */
void ApplyStateEffects();
/**
* Apply the given attribute effect
* @return the amount the attribute was shifted.
*/
int ApplyAttributeShiftEffect(AttributeEffect ae);
/** Apply all attribute effects */
void ApplyAttributeShiftEffects();
/** Apply all effects in order */
void ApplyAll();
/** Apply switches set on the action externally (e.g. enemy actions) */
void ProcessPostActionSwitches();
/**
* Tests if it makes sense to apply an action on the target.
* E.g. when it is dead.
*
* @param target the target to check
* @return true if valid, in case of false another target should be selected.
*/
virtual bool IsTargetValid(const Game_Battler& target) const;
/** @return whether the current target is valid */
bool IsCurrentTargetValid() const;
/**
* Gets the first line message that is displayed when the action is invoked.
* Usually of style "[Name] uses/casts [Weapon/Item/Skill]".
*
* @param line which line of the message to fetch
* @return message
*/
virtual std::string GetStartMessage(int line) const;
/** @return the pose the source should be in when performing the action */
virtual int GetSourcePose() const;
/** @return the CBA movement to use when performing the action */
virtual int GetCBAMovement() const;
/** @return the CBA afterimage setting to use when performing the action */
virtual int GetCBAAfterimage() const;
/** @return true if it is still possible to perform this action now. */
virtual bool ActionIsPossible() const;
/** @return the weapon animation data for this action (if applicable) */
virtual const lcf::rpg::BattlerAnimationItemSkill* GetWeaponAnimationData() const;
/** @return the weapon data for this action (if applicable) */
virtual const lcf::rpg::Item* GetWeaponData() const;
/**
* Gets the sound effect that is played when the action is starting.
*
* @return start se
*/
virtual const lcf::rpg::Sound* GetStartSe() const;
/**
* Gets the sound effect that is played then the action fails.
*
* @return result se
*/
virtual const lcf::rpg::Sound* GetFailureSe() const;
/**
* Returns the message used when the action fails.
*
* @return failure message
*/
virtual std::string GetFailureMessage() const;
/**
* Returns whether the attack would be reflected if used upon the target.
*
* @param the target to check
* @return true when reflected
*/
virtual bool IsReflected(const Game_Battler& target) const;
/**
* Returns the algorithm type of this object.
*/
Type GetType() const;
/**
* Set number of times to repeat the same action on a target
*/
void SetRepeat(int repeat);
/**
* Apply a combo number of hits to repeat the action.
*
* @param hits the number of combo hits
*/
virtual void ApplyComboHitsMultiplier(int hits);
/**
* Set the affected switch id
* @param s the switch id
*/
int SetAffectedSwitch(int s);
/**
* Set the affected hp
* @param hp the signed hp gain/loss value
*/
int SetAffectedHp(int hp);
/**
* Set whether the effect will absorb hp from the target
* @param a whether to absorb or not.
*/
bool SetIsAbsorbHp(bool a);
/**
* Set the affected sp
* @param hp the signed sp gain/loss value
*/
int SetAffectedSp(int sp);
/**
* Set whether the effect will absorb sp from the target
* @param a whether to absorb or not.
*/
bool SetIsAbsorbSp(bool a);
/**
* Set the affected atk
* @param hp the signed atk gain/loss value
*/
int SetAffectedAtk(int hp);
/**
* Set whether the effect will absorb atk from the target
* @param a whether to absorb or not.
*/
bool SetIsAbsorbAtk(bool a);
/**
* Set the affected def
* @param hp the signed def gain/loss value
*/
int SetAffectedDef(int hp);
/**
* Set whether the effect will absorb def from the target
* @param a whether to absorb or not.
*/
bool SetIsAbsorbDef(bool a);
/**
* Set the affected spi
* @param hp the signed spi gain/loss value
*/
int SetAffectedSpi(int hp);
/**
* Set whether the effect will absorb spi from the target
* @param a whether to absorb or not.
*/
bool SetIsAbsorbSpi(bool a);
/**
* Set the affected agi
* @param hp the signed agi gain/loss value
*/
int SetAffectedAgi(int hp);
/**
* Set whether the effect will absorb agi from the target
* @param a whether to absorb or not.
*/
bool SetIsAbsorbAgi(bool a);
/**
* Add a state effect
* @param se the state effect to add
*/
void AddAffectedState(StateEffect se);
/**
* Add an attribute shift effect
* @param se the attribute shift effect to add
*/
void AddAffectedAttribute(AttributeEffect ae);
/**
* Set if the original intention was positive (healing)
* @param p if positive or not
*/
bool SetIsPositive(bool p);
/**
* Set if the effect was a critical hit
* @param c if critical hit or not
*/
bool SetIsCriticalHit(bool c);
/** Set if the algo was a success */
bool SetIsSuccess();
/**
* Set the algo to successful if the condition is true. If it's false, no change.
* @param x condition to check
*/
bool SetIsSuccessIf(bool x);
/** Set if the algo failed */
bool SetIsFailure();
protected:
AlgorithmBase(Type t, Game_Battler* source, Game_Battler* target);
AlgorithmBase(Type t, Game_Battler* source, std::vector<Game_Battler*> targets);
AlgorithmBase(Type t, Game_Battler* source, Game_Party_Base* target);
virtual bool vStart();
virtual bool vExecute();
void Reset();
/**
* Implements logic of TargetNext but ignores reflect.
* Used by const-functions that restore the old state afterwards.
* So technically this function is non-const but due to the help of the
* other functions the behaviour to the callee is const...
*
* @return true if there was a next target available
*/
bool TargetNextInternal();
void BattlePhysicalStateHeal(int physical_rate, std::vector<int16_t>& target_states, const PermanentStates& ps);
private:
Type type = Type::None;
Game_Battler* source = nullptr;
std::vector<Game_Battler*> targets;
std::vector<Game_Battler*>::iterator current_target;
Game_Party_Base* party_target = nullptr;
Game_Battler* reflect_target = nullptr;
int hp = 0;
int sp = 0;
int attack = 0;
int defense = 0;
int spirit = 0;
int agility = 0;
int switch_id = 0;
enum Flag {
eSuccess,
ePositive,
eCriticalHit,
eRevived,
eAffectHp,
eAbsorbHp,
eAffectSp,
eAbsorbSp,
eAffectAtk,
eAbsorbAtk,
eAffectDef,
eAbsorbDef,
eAffectSpi,
eAbsorbSpi,
eAffectAgi,
eAbsorbAgi,
};
std::bitset<64> flags = {};
int num_original_targets = 0;
int cur_repeat = 0;
int repeat = 1;
std::vector<StateEffect> states;
std::vector<AttributeEffect> attributes;
std::vector<int> switch_on;
std::vector<int> switch_off;
bool SetFlag(Flag f, bool value);
bool GetFlag(Flag f) const;
};
// Special algorithm for handling non-moving because of states
class None : public AlgorithmBase {
public:
None(Game_Battler* source);
};
class Normal : public AlgorithmBase {
public:
enum Style {
/** 2k style, single combined attack with both weapons */
Style_Combined,
/** 2k3 style, multiple attacks, one per weapon */
Style_MultiHit,
};
static Style GetDefaultStyle();
Normal(Game_Battler* source, Game_Battler* target, int hits_multiplier = 1, Style style = GetDefaultStyle());
Normal(Game_Battler* source, Game_Party_Base* target, int hits_multiplier = 1, Style style = GetDefaultStyle());
bool vExecute() override;
bool vStart() override;
int GetAnimationId(int i) const override;
std::string GetStartMessage(int line) const override;
int GetSourcePose() const override;
int GetCBAMovement() const override;
int GetCBAAfterimage() const override;
const lcf::rpg::BattlerAnimationItemSkill* GetWeaponAnimationData() const override;
const lcf::rpg::Item* GetWeaponData() const override;
const lcf::rpg::Sound* GetStartSe() const override;
Game_Battler::Weapon GetWeapon() const;
void ApplyComboHitsMultiplier(int hits) override;
// Emulates an RPG_RT bug where whenver an actor attacks an enemy, the hit rate and damage
// is adjusted as if the enemy were in the front row.
void SetTreatEnemiesAsIfInFrontRow(bool v);
// Return true if this is a charged attack.
bool IsChargedAttack() const;
private:
void Init(Style style);
int hits_multiplier = 1;
int weapon_style = -1;
bool charged_attack = false;
bool treat_enemies_asif_in_front_row = false;
};
class Skill : public AlgorithmBase {
public:
Skill(Game_Battler* source, Game_Battler* target, const lcf::rpg::Skill& skill, const lcf::rpg::Item* item = NULL);
Skill(Game_Battler* source, Game_Party_Base* target, const lcf::rpg::Skill& skill, const lcf::rpg::Item* item = NULL);
Skill(Game_Battler* source, const lcf::rpg::Skill& skill, const lcf::rpg::Item* item = NULL);
bool IsTargetValid(const Game_Battler&) const override;
bool vExecute() override;
bool vStart() override;
int GetAnimationId(int i) const override;
std::string GetStartMessage(int line) const override;
int GetSourcePose() const override;
int GetCBAMovement() const override;
int GetCBAAfterimage() const override;
const lcf::rpg::Sound* GetStartSe() const override;
const lcf::rpg::Sound* GetFailureSe() const override;
std::string GetFailureMessage() const override;
bool IsReflected(const Game_Battler&) const override;
bool ActionIsPossible() const override;
const lcf::rpg::Skill& GetSkill() const;
const lcf::rpg::Item* GetItem() const;
private:
void Init();
std::string GetFirstStartMessage() const;
std::string GetSecondStartMessage() const;
const lcf::rpg::Skill& skill;
const lcf::rpg::Item* item;
};
class Item : public AlgorithmBase {
public:
Item(Game_Battler* source, Game_Battler* target, const lcf::rpg::Item& item);
Item(Game_Battler* source, Game_Party_Base* target, const lcf::rpg::Item& item);
Item(Game_Battler* source, const lcf::rpg::Item& item);
bool IsTargetValid(const Game_Battler&) const override;
bool vExecute() override;
bool vStart() override;
std::string GetStartMessage(int line) const override;
int GetSourcePose() const override;
int GetCBAMovement() const override;
const lcf::rpg::Sound* GetStartSe() const override;
bool ActionIsPossible() const override;
private:
std::string GetFirstStartMessage() const;
std::string GetSecondStartMessage() const;
const lcf::rpg::Item& item;
};
class Defend : public AlgorithmBase {
public:
Defend(Game_Battler* source);
std::string GetStartMessage(int line) const override;
int GetSourcePose() const override;
};
class Observe : public AlgorithmBase {
public:
Observe(Game_Battler* source);
std::string GetStartMessage(int line) const override;
};
class Charge : public AlgorithmBase {
public:
Charge(Game_Battler* source);
std::string GetStartMessage(int line) const override;
void ApplyCustomEffect() override;
};
class SelfDestruct : public AlgorithmBase {
public:
SelfDestruct(Game_Battler* source, Game_Party_Base* target);
std::string GetStartMessage(int line) const override;
const lcf::rpg::Sound* GetStartSe() const override;
bool vExecute() override;
void ApplyCustomEffect() override;
private:
bool animate = true;
};
class Escape : public AlgorithmBase {
public:
Escape(Game_Battler* source);
std::string GetStartMessage(int line) const override;
int GetSourcePose() const override;
const lcf::rpg::Sound* GetStartSe() const override;
void ApplyCustomEffect() override;
};
class Transform : public AlgorithmBase {
public:
Transform(Game_Battler* source, int new_monster_id);
std::string GetStartMessage(int line) const override;
void ApplyCustomEffect() override;
private:
int new_monster_id;
};
// EnemyAi "Do Nothing" action. Handled slightly differently than None.
class DoNothing : public AlgorithmBase {
public:
DoNothing(Game_Battler* source);
};
inline Type AlgorithmBase::GetType() const {
return type;
}
inline const std::vector<StateEffect>& AlgorithmBase::GetStateEffects() const {
return states;
}
inline Game_Party_Base* AlgorithmBase::GetOriginalPartyTarget() const {
return party_target;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetAffectedHp() const {
return hp;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetAffectedSp() const {
return sp;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetAffectedAtk() const {
return attack;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetAffectedDef() const {
return defense;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetAffectedSpi() const {
return spirit;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetAffectedAgi() const {
return agility;
}
inline const std::vector<Game_BattleAlgorithm::AttributeEffect>& Game_BattleAlgorithm::AlgorithmBase::GetShiftedAttributes() const {
return attributes;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetAffectedSwitch() const {
return switch_id;
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsPositive() const {
return GetFlag(ePositive);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsRevived() const {
return GetFlag(eRevived);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::ActionIsPossible() const {
return true;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetAnimationId(int) const {
return 0;
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAffectHp() const {
return GetFlag(eAffectHp);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAbsorbHp() const {
return GetFlag(eAbsorbHp);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAffectSp() const {
return GetFlag(eAffectSp);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAbsorbSp() const {
return GetFlag(eAbsorbSp);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAffectAtk() const {
return GetFlag(eAffectAtk);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAbsorbAtk() const {
return GetFlag(eAbsorbAtk);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAffectDef() const {
return GetFlag(eAffectDef);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAbsorbDef() const {
return GetFlag(eAbsorbDef);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAffectSpi() const {
return GetFlag(eAffectSpi);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAbsorbSpi() const {
return GetFlag(eAbsorbSpi);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAffectAgi() const {
return GetFlag(eAffectAgi);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsAbsorbAgi() const {
return GetFlag(eAbsorbAgi);
}
inline Game_Battler* Game_BattleAlgorithm::AlgorithmBase::GetReflectTarget() const {
return reflect_target;
}
inline Span<Game_Battler* const> Game_BattleAlgorithm::AlgorithmBase::GetOriginalTargets() const {
assert(num_original_targets <= static_cast<int>(targets.size()));
return Span<Game_Battler* const>(targets.data(), num_original_targets);
}
inline Game_Battler* Game_BattleAlgorithm::AlgorithmBase::GetOriginalSingleTarget() const {
assert(num_original_targets <= static_cast<int>(targets.size()));
return (GetOriginalPartyTarget() == nullptr && num_original_targets == 1) ? targets.front() : nullptr;
}
inline int Game_BattleAlgorithm::AlgorithmBase::SetAffectedSwitch(int s) {
return this->switch_id = s;
}
inline int Game_BattleAlgorithm::AlgorithmBase::SetAffectedHp(int hp) {
SetFlag(eAffectHp, true);
return this->hp = hp;
}
inline int Game_BattleAlgorithm::AlgorithmBase::SetAffectedSp(int sp) {
SetFlag(eAffectSp, true);
return this->sp = sp;
}
inline int Game_BattleAlgorithm::AlgorithmBase::SetAffectedAtk(int atk) {
SetFlag(eAffectAtk, true);
return this->attack = atk;
}
inline int Game_BattleAlgorithm::AlgorithmBase::SetAffectedDef(int def) {
SetFlag(eAffectDef, true);
return this->defense = def;
}
inline int Game_BattleAlgorithm::AlgorithmBase::SetAffectedSpi(int spi) {
SetFlag(eAffectSpi, true);
return this->spirit = spi;
}
inline int Game_BattleAlgorithm::AlgorithmBase::SetAffectedAgi(int agi) {
SetFlag(eAffectAgi, true);
return this->agility = agi;
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsPositive(bool p) {
return SetFlag(ePositive, p);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsCriticalHit(bool c) {
return SetFlag(eCriticalHit, c);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsSuccess() {
return SetFlag(eSuccess, true);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsSuccessIf(bool x) {
return SetFlag(eSuccess, GetFlag(eSuccess) | x);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsFailure() {
return SetFlag(eSuccess, false);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsSuccess() const {
return GetFlag(eSuccess);
}
inline bool Game_BattleAlgorithm::AlgorithmBase::IsCriticalHit() const {
return GetFlag(eCriticalHit);
}
inline Game_Battler* Game_BattleAlgorithm::AlgorithmBase::GetSource() const {
return source;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetCurrentRepeat() const {
return cur_repeat;
}
inline int Game_BattleAlgorithm::AlgorithmBase::GetTotalRepetitions() const {
return repeat;
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetFlag(Flag f, bool value) {
flags.set(uint64_t(f), value);
return value;
}
inline bool Game_BattleAlgorithm::AlgorithmBase::GetFlag(Flag f) const {
return flags.test(uint64_t(f));
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsAbsorbHp(bool a) {
SetFlag(eAbsorbHp, a);
return a;
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsAbsorbSp(bool a) {
SetFlag(eAbsorbSp, a);
return a;
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsAbsorbAtk(bool a) {
SetFlag(eAbsorbAtk, a);
return a;
}
inline bool Game_BattleAlgorithm::AlgorithmBase::SetIsAbsorbDef(bool a) {