예제 #1
0
bool Game_Actor::UseItem(int item_id, const Game_Battler* source) {
	const RPG::Item* item = ReaderUtil::GetElement(Data::items, item_id);
	if (!item) {
		Output::Warning("UseItem: Can't use invalid item %d", item_id);
		return false;
	}

	if (IsDead() && item->type != RPG::Item::Type_medicine) {
		return false;
	}

	if (item->type == RPG::Item::Type_book) {
		return LearnSkill(item->skill_id);
	}

	if (item->type == RPG::Item::Type_material) {
		SetBaseMaxHp(GetBaseMaxHp() + item->max_hp_points);
		SetBaseMaxSp(GetBaseMaxSp() + item->max_sp_points);
		SetBaseAtk(GetBaseAtk() + item->atk_points2);
		SetBaseDef(GetBaseDef() + item->def_points2);
		SetBaseAgi(GetBaseAgi() + item->agi_points2);
		SetBaseSpi(GetBaseSpi() + item->spi_points2);

		return true;
	}

	return Game_Battler::UseItem(item_id, source);
}
예제 #2
0
int Game_Battler::GetMaxHp() const {
	return GetBaseMaxHp();
}
예제 #3
0
void Game_Actor::SetBaseMaxHp(int maxhp) {
	data.hp_mod += maxhp - GetBaseMaxHp();
	SetHp(data.current_hp);
}
예제 #4
0
int Game_Actor::GetBaseMaxHp() const {
	return GetBaseMaxHp(true);
}
예제 #5
0
void Game_Actor::SetBaseMaxHp(int maxhp) {
	int new_hp_mod = GetData().hp_mod + (maxhp - GetBaseMaxHp());
	GetData().hp_mod = new_hp_mod;

	SetHp(GetData().current_hp);
}