2019-11-08 17:45:43 +00:00
|
|
|
#ifndef CREATURELIB_SCRIPT_HPP
|
|
|
|
#define CREATURELIB_SCRIPT_HPP
|
|
|
|
|
2020-04-10 15:54:45 +00:00
|
|
|
#include "../../Library/EffectParameter.hpp"
|
2020-04-09 16:19:21 +00:00
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
namespace CreatureLib::Battling {
|
2019-11-10 13:32:05 +00:00
|
|
|
class BaseTurnChoice;
|
2019-11-23 10:53:00 +00:00
|
|
|
class AttackTurnChoice;
|
2019-12-14 11:15:30 +00:00
|
|
|
class SwitchTurnChoice;
|
2021-03-27 14:10:56 +00:00
|
|
|
class FleeTurnChoice;
|
2019-11-09 11:15:45 +00:00
|
|
|
class ExecutingAttack;
|
|
|
|
class Creature;
|
|
|
|
|
2021-03-07 09:26:41 +00:00
|
|
|
class BattleScript {
|
2021-10-29 19:31:01 +00:00
|
|
|
ArbUt::OptionalBorrowedPtr<void> _owner;
|
|
|
|
|
2019-11-08 17:45:43 +00:00
|
|
|
public:
|
2021-10-29 19:55:49 +00:00
|
|
|
BattleScript(const ArbUt::OptionalBorrowedPtr<void>& owner) { _owner = owner; };
|
2021-03-07 09:26:41 +00:00
|
|
|
NO_COPY_OR_MOVE(BattleScript);
|
|
|
|
|
2021-10-29 19:31:01 +00:00
|
|
|
inline ArbUt::OptionalBorrowedPtr<void> GetOwner() const noexcept { return _owner; }
|
|
|
|
|
2021-03-07 09:26:41 +00:00
|
|
|
virtual ~BattleScript() = default;
|
2019-11-08 17:45:43 +00:00
|
|
|
|
2021-10-29 19:55:49 +00:00
|
|
|
virtual BattleScript* Clone(const ArbUt::OptionalBorrowedPtr<void>& owner) = 0;
|
2021-04-11 13:20:50 +00:00
|
|
|
|
2019-11-08 17:45:43 +00:00
|
|
|
virtual void Stack(){};
|
2020-02-05 13:52:50 +00:00
|
|
|
virtual void OnRemove(){};
|
2019-11-08 17:45:43 +00:00
|
|
|
|
2021-03-07 09:26:41 +00:00
|
|
|
[[nodiscard]] virtual const ArbUt::StringView& GetName() const noexcept = 0;
|
2019-11-09 11:15:45 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void
|
|
|
|
OnInitialize([[maybe_unused]] const ArbUt::List<CreatureLib::Library::EffectParameter*>& parameters){};
|
|
|
|
virtual void OnBeforeTurn([[maybe_unused]] const BaseTurnChoice* choice){};
|
2019-11-23 10:53:00 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void ChangePriority([[maybe_unused]] AttackTurnChoice* choice, [[maybe_unused]] int8_t* priority){};
|
|
|
|
virtual void ChangeAttack([[maybe_unused]] AttackTurnChoice* choice,
|
|
|
|
[[maybe_unused]] ArbUt::StringView* outAttack){};
|
2021-03-28 17:43:26 +00:00
|
|
|
virtual void ModifyNumberOfHits([[maybe_unused]] AttackTurnChoice* choice, [[maybe_unused]] u8* numberOfHits){};
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void PreventAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outResult){};
|
|
|
|
virtual void FailAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outFailed){};
|
|
|
|
virtual void StopBeforeAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outResult){};
|
|
|
|
virtual void OnBeforeAttack([[maybe_unused]] ExecutingAttack* attack){};
|
2019-11-23 10:53:00 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void FailIncomingAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
|
|
|
[[maybe_unused]] bool* outResult){};
|
|
|
|
virtual void IsInvulnerable([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
|
|
|
[[maybe_unused]] bool* outResult){};
|
|
|
|
virtual void OnAttackMiss([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target){};
|
|
|
|
virtual void ChangeAttackType([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitNumber, [[maybe_unused]] u8* outType){};
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void ChangeEffectiveness([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitNumber, [[maybe_unused]] float* effectiveness){};
|
2020-02-19 09:12:36 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void OverrideBasePower([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] u8* basePower){};
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void ChangeDamageStatsUser([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] Creature** statsUser){};
|
2020-02-19 09:12:36 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void BypassDefensiveStat([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] bool* bypass){};
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void BypassOffensiveStat([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] bool* bypass){};
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void ModifyStatModifier([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] float* modifier){};
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void ModifyDamageModifier([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] float* modifier){};
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void OverrideDamage([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] u32* damage){};
|
2021-10-29 16:24:46 +00:00
|
|
|
virtual void OverrideIncomingDamage([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
|
|
|
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] u32* damage){};
|
2020-02-19 09:12:36 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void PreventSecondaryEffects([[maybe_unused]] const ExecutingAttack* attack,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] Creature* target, [[maybe_unused]] u8 hitNumber,
|
2020-07-17 11:12:21 +00:00
|
|
|
[[maybe_unused]] bool* outResult){};
|
|
|
|
virtual void OnSecondaryEffect([[maybe_unused]] const ExecutingAttack* attack,
|
2021-03-07 09:26:41 +00:00
|
|
|
[[maybe_unused]] Creature* target, [[maybe_unused]] u8 hitNumber){};
|
2019-11-09 11:55:48 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void OnAfterHits([[maybe_unused]] const ExecutingAttack* attack, [[maybe_unused]] Creature* target){};
|
2019-12-14 11:15:30 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void PreventSelfSwitch([[maybe_unused]] const SwitchTurnChoice* choice,
|
|
|
|
[[maybe_unused]] bool* outResult){};
|
2021-03-27 21:54:51 +00:00
|
|
|
virtual void PreventOpponentSwitch([[maybe_unused]] const SwitchTurnChoice* choice,
|
|
|
|
[[maybe_unused]] bool* outResult){};
|
2020-02-16 14:08:22 +00:00
|
|
|
|
2020-07-17 11:12:21 +00:00
|
|
|
virtual void ModifyEffectChance([[maybe_unused]] const ExecutingAttack* attack,
|
|
|
|
[[maybe_unused]] Creature* target, [[maybe_unused]] float* chance){};
|
|
|
|
virtual void ModifyIncomingEffectChance([[maybe_unused]] const ExecutingAttack* attack,
|
|
|
|
[[maybe_unused]] Creature* target, [[maybe_unused]] float* chance){};
|
2021-03-27 11:30:12 +00:00
|
|
|
|
|
|
|
virtual void OnFail([[maybe_unused]] Creature* target){};
|
|
|
|
virtual void OnOpponentFail([[maybe_unused]] Creature* target){};
|
2021-03-27 13:49:17 +00:00
|
|
|
|
2021-03-27 14:10:56 +00:00
|
|
|
virtual void PreventRunAway([[maybe_unused]] const FleeTurnChoice* choice, [[maybe_unused]] bool* result){};
|
|
|
|
virtual void PreventOpponentRunAway([[maybe_unused]] const FleeTurnChoice* choice,
|
|
|
|
[[maybe_unused]] bool* result){};
|
2021-03-28 16:24:49 +00:00
|
|
|
|
2021-10-29 17:31:08 +00:00
|
|
|
virtual void OnEndTurn(){};
|
2019-11-08 17:45:43 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
#endif // CREATURELIB_SCRIPT_HPP
|