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

Method CommandSimulatedAttack

src/game_interpreter.cpp:1915–1939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1913}
1914
1915bool Game_Interpreter::CommandSimulatedAttack(lcf::rpg::EventCommand const& com) { // code 10500
1916 int atk = com.parameters[2];
1917 int def = com.parameters[3];
1918 int spi = com.parameters[4];
1919 int var = com.parameters[5];
1920
1921 for (const auto& actor : GetActors(com.parameters[0], com.parameters[1])) {
1922 int result = atk;
1923 result -= (actor->GetDef() * def) / 400;
1924 result -= (actor->GetSpi() * spi) / 800;
1925 result = std::max(result, 0);
1926 result = Algo::VarianceAdjustEffect(result, var);
1927
1928 result = std::max(0, result);
1929 actor->ChangeHp(-result, true);
1930
1931 if (com.parameters[6] != 0) {
1932 Main_Data::game_variables->Set(com.parameters[7], result);
1933 Game_Map::SetNeedRefresh(true);
1934 }
1935 }
1936
1937 CheckGameOver();
1938 return true;
1939}
1940
1941bool Game_Interpreter::CommandWait(lcf::rpg::EventCommand const& com) { // code 11410
1942 auto& index = GetFrame().current_command;

Callers

nothing calls this directly

Calls 6

maxFunction · 0.85
VarianceAdjustEffectFunction · 0.85
GetDefMethod · 0.80
GetSpiMethod · 0.80
ChangeHpMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected