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

Method CommandChangeHP

src/game_interpreter.cpp:1836–1860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1834}
1835
1836bool Game_Interpreter::CommandChangeHP(lcf::rpg::EventCommand const& com) { // Code 10460
1837 bool remove = com.parameters[2] != 0;
1838 int amount = ValueOrVariable(com.parameters[3],
1839 com.parameters[4]);
1840 bool lethal = com.parameters[5] != 0;
1841
1842 if (remove)
1843 amount = -amount;
1844
1845 for (const auto& actor : GetActors(com.parameters[0], com.parameters[1])) {
1846 actor->ChangeHp(amount, lethal);
1847
1848 auto& scene = Scene::instance;
1849 if (scene) {
1850 scene->OnEventHpChanged(actor, amount);
1851 }
1852
1853 if (actor->IsDead() && actor->GetActorBattleSprite()) {
1854 actor->GetActorBattleSprite()->DetectStateChange();
1855 }
1856 }
1857
1858 CheckGameOver();
1859 return true;
1860}
1861
1862bool Game_Interpreter::CommandChangeSP(lcf::rpg::EventCommand const& com) { // Code 10470
1863 bool remove = com.parameters[2] != 0;

Callers

nothing calls this directly

Calls 5

ChangeHpMethod · 0.80
IsDeadMethod · 0.80
GetActorBattleSpriteMethod · 0.80
DetectStateChangeMethod · 0.80
OnEventHpChangedMethod · 0.45

Tested by

no test coverage detected