Move priority scripthook to more sensible place in turn flow.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
b3366f7b58
commit
f50f76e993
|
@ -30,5 +30,13 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void TurnOrdering::OrderChoices(std::vector<std::shared_ptr<BaseTurnChoice>>& vec, ArbUt::Random& rand) {
|
void TurnOrdering::OrderChoices(std::vector<std::shared_ptr<BaseTurnChoice>>& vec, ArbUt::Random& rand) {
|
||||||
|
for (auto item : vec) {
|
||||||
|
if (item->GetKind() == TurnChoiceKind::Attack) {
|
||||||
|
auto attackChoice = static_cast<AttackTurnChoice*>(item.get());
|
||||||
|
auto priority = attackChoice->GetPriority();
|
||||||
|
HOOK(ChangePriority, attackChoice, attackChoice, &priority);
|
||||||
|
attackChoice->SetPriority(priority);
|
||||||
|
}
|
||||||
|
}
|
||||||
std::sort(vec.begin(), vec.end(), ChoiceCompare());
|
std::sort(vec.begin(), vec.end(), ChoiceCompare());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace CreatureLib::Battling {
|
||||||
AssertNotNull(attack)
|
AssertNotNull(attack)
|
||||||
#endif
|
#endif
|
||||||
ResolveScript();
|
ResolveScript();
|
||||||
HOOK(ChangePriority, this, this, &_priority);
|
_priority = _attack->GetAttack()->GetPriority();
|
||||||
}
|
}
|
||||||
AttackTurnChoice(Creature* user, const ArbUt::BorrowedPtr<LearnedAttack>& attack, const CreatureIndex& target,
|
AttackTurnChoice(Creature* user, const ArbUt::BorrowedPtr<LearnedAttack>& attack, const CreatureIndex& target,
|
||||||
Script* script)
|
Script* script)
|
||||||
|
@ -52,7 +52,7 @@ namespace CreatureLib::Battling {
|
||||||
AssertNotNull(user)
|
AssertNotNull(user)
|
||||||
AssertNotNull(attack)
|
AssertNotNull(attack)
|
||||||
#endif
|
#endif
|
||||||
HOOK(ChangePriority, this, this, &_priority);
|
_priority = _attack->GetAttack()->GetPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
~AttackTurnChoice() = default;
|
~AttackTurnChoice() = default;
|
||||||
|
@ -61,7 +61,8 @@ namespace CreatureLib::Battling {
|
||||||
|
|
||||||
TurnChoiceKind GetKind() const noexcept override { return TurnChoiceKind ::Attack; }
|
TurnChoiceKind GetKind() const noexcept override { return TurnChoiceKind ::Attack; }
|
||||||
|
|
||||||
inline int8_t GetPriority() const { return _attack->GetAttack()->GetPriority(); }
|
inline int8_t GetPriority() const noexcept { return _priority; }
|
||||||
|
inline void SetPriority(int8_t priority) noexcept { _priority = priority; }
|
||||||
|
|
||||||
const CreatureIndex& GetTarget() const noexcept { return _target; }
|
const CreatureIndex& GetTarget() const noexcept { return _target; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue