Beispiel #1
0
void Scene_Battle::ItemSelected() {
	const RPG::Item* item = item_window->GetItem();

	skill_item = NULL;

	if (!item || !Main_Data::game_party->IsItemUsable(item->ID)) {
		Game_System::SePlay(Data::system.buzzer_se);
		return;
	}

	Game_System::SePlay(Data::system.decision_se);

	if (item->entire_party) {
		active_actor->SetBattleAlgorithm(EASYRPG_MAKE_SHARED<Game_BattleAlgorithm::Item>(active_actor, Main_Data::game_party.get(), *item_window->GetItem()));
		ActionSelectedCallback(active_actor);
	}
	else {
		if (item->type == RPG::Item::Type_switch) {
			active_actor->SetBattleAlgorithm(EASYRPG_MAKE_SHARED<Game_BattleAlgorithm::Item>(active_actor, *item_window->GetItem()));
			ActionSelectedCallback(active_actor);
		}
		else if (item->type == RPG::Item::Type_special) {
			skill_item = item;
			AssignSkill(&Data::skills[item->skill_id - 1]);
		}
		else {
			SetState(State_SelectAllyTarget);
			status_window->SetChoiceMode(Window_BattleStatus::ChoiceMode_All);
		}
	}
}
Beispiel #2
0
void Scene_Battle::SkillSelected() {
	const RPG::Skill* skill = skill_window->GetSkill();

	skill_item = NULL;

	if (!skill || !active_actor->IsSkillUsable(skill->ID)) {
		Game_System::SePlay(Data::system.buzzer_se);
		return;
	}

	Game_System::SePlay(Data::system.decision_se);

	AssignSkill(skill);
}
Beispiel #3
0
void Scene_Battle::SkillSelected() {
	const RPG::Skill* skill = skill_window->GetSkill();

	skill_item = NULL;

	if (!skill || !active_actor->IsSkillUsable(skill->ID)) {
		Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Buzzer));
		return;
	}

	Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision));

	AssignSkill(skill);
}
Beispiel #4
0
void Scene_Battle::ItemSelected() {
	const RPG::Item* item = item_window->GetItem();

	skill_item = nullptr;

	if (!item || !item_window->CheckEnable(item->ID)) {
		Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Buzzer));
		return;
	}

	Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Decision));

	switch (item->type) {
		case RPG::Item::Type_normal:
		case RPG::Item::Type_book:
		case RPG::Item::Type_material:
			assert(false);
			return;
		case RPG::Item::Type_weapon:
		case RPG::Item::Type_shield:
		case RPG::Item::Type_armor:
		case RPG::Item::Type_helmet:
		case RPG::Item::Type_accessory:
		case RPG::Item::Type_special: {
			const RPG::Skill* skill = ReaderUtil::GetElement(Data::skills, item->skill_id);
			if (!skill) {
				Output::Warning("ItemSelected: Item %d references invalid skill %d", item->ID, item->skill_id);
				return;
			}
			skill_item = item;
			AssignSkill(skill);
			break;
		}
		case RPG::Item::Type_medicine:
			if (item->entire_party) {
				active_actor->SetBattleAlgorithm(std::make_shared<Game_BattleAlgorithm::Item>(active_actor, Main_Data::game_party.get(), *item_window->GetItem()));
				ActionSelectedCallback(active_actor);
			} else {
				SetState(State_SelectAllyTarget);
				status_window->SetChoiceMode(Window_BattleStatus::ChoiceMode_All);
			}
			break;
		case RPG::Item::Type_switch:
			active_actor->SetBattleAlgorithm(std::make_shared<Game_BattleAlgorithm::Item>(active_actor, *item_window->GetItem()));
			ActionSelectedCallback(active_actor);
			break;
	}
}