MCPcopy Create free account
hub / github.com/EasyRPG/Player / BattlePhysicalStateHeal

Method BattlePhysicalStateHeal

src/game_battlealgorithm.cpp:559–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559void Game_BattleAlgorithm::AlgorithmBase::BattlePhysicalStateHeal(int physical_rate, std::vector<int16_t>& target_states, const PermanentStates& ps) {
560 if (physical_rate <= 0) {
561 return;
562 }
563
564 for (int i = 0; i < (int)target_states.size(); ++i) {
565 auto state_id = i + 1;
566 if (!State::Has(state_id, target_states)) {
567 continue;
568 }
569
570 auto* state = lcf::ReaderUtil::GetElement(lcf::Data::states, state_id);
571 if (state == nullptr) {
572 continue;
573 }
574 if (state->release_by_damage > 0) {
575 int release_chance = state->release_by_damage * physical_rate / 100;
576
577 if (!Rand::ChanceOf(release_chance, 100)) {
578 continue;
579 }
580
581 if (State::Remove(state_id, target_states, ps)) {
582 AddAffectedState(StateEffect{state_id, Game_BattleAlgorithm::StateEffect::HealedByAttack});
583 }
584 }
585 }
586}
587
588
589

Callers

nothing calls this directly

Calls 2

RemoveFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected