void Game_Party::SetupBattleTestMembers() { Clear(); for (auto& btdata : Data::system.battletest_data) { AddActor(btdata.actor_id); Game_Actor* actor = Game_Actors::GetActor(btdata.actor_id); // Filter garbage btdata inserted by the editor std::array<int, 5> ids = { btdata.weapon_id, btdata.shield_id, btdata.armor_id, btdata.helmet_id, btdata.accessory_id }; std::replace_if(ids.begin(), ids.end(), [] (const int& item_id) { return ReaderUtil::GetElement(Data::items, item_id) == nullptr; }, 0); actor->SetEquipment(RPG::Item::Type_weapon, ids[0]); actor->SetEquipment(RPG::Item::Type_shield, ids[1]); actor->SetEquipment(RPG::Item::Type_armor, ids[2]); actor->SetEquipment(RPG::Item::Type_helmet, ids[3]); actor->SetEquipment(RPG::Item::Type_accessory, ids[4]); actor->ChangeLevel(btdata.level, false); actor->SetHp(actor->GetMaxHp()); actor->SetSp(actor->GetMaxSp()); } data().party_size = data().party.size(); Main_Data::game_player->Refresh(); }
void Game_Party::ApplyDamage(int damage) { if (damage <= 0) { return; } std::vector<Game_Actor*> actors = GetActors(); for (std::vector<Game_Actor*>::iterator i = actors.begin(); i != actors.end(); ++i) { Game_Actor* actor = *i; actor->SetHp(actor->GetHp() - damage); } }
bool Game_Interpreter::CommandFullHeal(RPG::EventCommand const& com) { // Code 10490 std::vector<Game_Actor*> actors = GetActors(com.parameters[0], com.parameters[1]); for (std::vector<Game_Actor*>::iterator i = actors.begin(); i != actors.end(); i++) { Game_Actor* actor = *i; actor->SetHp(actor->GetMaxHp()); actor->SetSp(actor->GetMaxSp()); actor->RemoveAllStates(); } return true; }
void Game_Party::SetupBattleTestMembers() { data.party.clear(); std::vector<RPG::TestBattler>::const_iterator it; for (it = Data::system.battletest_data.begin(); it != Data::system.battletest_data.end(); ++it) { AddActor(it->actor_id); Game_Actor* actor = Game_Actors::GetActor(it->actor_id); actor->SetEquipment(0, it->weapon_id); actor->SetEquipment(1, it->shield_id); actor->SetEquipment(1, it->armor_id); actor->SetEquipment(1, it->helmet_id); actor->SetEquipment(1, it->accessory_id); actor->ChangeLevel(it->level, false); actor->SetHp(actor->GetMaxHp()); actor->SetSp(actor->GetMaxSp()); } Main_Data::game_player->Refresh(); }
bool Game_Interpreter::CommandChangeHP(RPG::EventCommand const& com) { // Code 10460 std::vector<Game_Actor*> actors = GetActors(com.parameters[0], com.parameters[1]); bool remove = com.parameters[2] != 0; int amount = ValueOrVariable(com.parameters[3], com.parameters[4]); bool lethal = com.parameters[5] != 0; if (remove) amount = -amount; for (std::vector<Game_Actor*>::iterator i = actors.begin(); i != actors.end(); i++) { Game_Actor* actor = *i; int hp = actor->GetHp() + amount; if (hp < 0) hp = lethal ? 0 : 1; actor->SetHp(hp); } return true; }