Initialize Creature talent script when battle library is set, allow talent overriding
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -23,8 +23,11 @@ Battling::Creature::Creature(const Library::CreatureSpecies* species, const Libr
|
||||
__HeldItem(heldItem),
|
||||
_nickname(std::move(nickname)),
|
||||
_talentIndex(talent),
|
||||
_hasOverridenTalent(false),
|
||||
_attacks(std::move(attacks))
|
||||
{}
|
||||
{
|
||||
__CurrentHealth = GetBoostedStat(Core::Statistic::Health);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +42,7 @@ void Battling::Creature::SetBattle(Battling::Battle *battle) {
|
||||
|
||||
void Battling::Creature::SetBattleLibrary(Battling::BattleLibrary *library) {
|
||||
this->_library = library;
|
||||
_activeTalent = _library->LoadScript(ScriptResolver::ScriptCategory::Talent, GetActiveTalent());
|
||||
}
|
||||
|
||||
const std::string &Battling::Creature::GetNickname() const {
|
||||
@@ -47,7 +51,10 @@ const std::string &Battling::Creature::GetNickname() const {
|
||||
return _nickname;
|
||||
}
|
||||
|
||||
const std::string &Battling::Creature::GetTalent() const {
|
||||
const std::string &Battling::Creature::GetActiveTalent() const {
|
||||
if (_hasOverridenTalent){
|
||||
return _overridenTalentName;
|
||||
}
|
||||
return __Variant->GetTalent(_talentIndex);
|
||||
}
|
||||
|
||||
@@ -131,6 +138,12 @@ void Battling::Creature::Damage(uint32_t damage, Battling::DamageSource source)
|
||||
__CurrentHealth -= damage;
|
||||
}
|
||||
|
||||
void Battling::Creature::OverrideActiveTalent(const std::string& talent){
|
||||
_hasOverridenTalent = true;
|
||||
_overridenTalentName = talent;
|
||||
_activeTalent = this->_library->LoadScript(ScriptResolver::ScriptCategory::Talent, talent);
|
||||
}
|
||||
|
||||
const std::vector<uint8_t>& Battling::Creature::GetTypes() const {
|
||||
//HOOK: override types.
|
||||
return this->__Variant->GetTypes();
|
||||
|
||||
Reference in New Issue
Block a user