Exemplo n.º 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);
}
Exemplo n.º 2
0
int Game_Battler::GetAtk() const {
	int base_atk = GetBaseAtk();
	int n = min(max(base_atk, 1), 999);

	const std::vector<int16_t>& states = GetStates();
	for (std::vector<int16_t>::const_iterator i = states.begin(); i != states.end(); i++) {
		if(Data::states[(*i)].affect_attack) {
			n = AffectParameter(Data::states[(*i)].affect_type, base_atk);
			break;
		}
	}

	n = min(max(n, 1), 999);

	return n;
}
Exemplo n.º 3
0
int Game_Battler::GetAtk() const {
	int base_atk = GetBaseAtk();
	int n = min(max(base_atk, 1), 999);

	for (int16_t i : GetInflictedStates()) {
		// States are guaranteed to be valid
		const RPG::State& state = *ReaderUtil::GetElement(Data::states, i);
		if (state.affect_attack) {
			n = AffectParameter(state.affect_type, base_atk);
			break;
		}
	}

	n += atk_modifier;

	n = min(max(n, 1), 999);

	return n;
}
Exemplo n.º 4
0
void Game_Actor::SetBaseAtk(int atk) {
	data.attack_mod += atk - GetBaseAtk();
}
Exemplo n.º 5
0
int Game_Actor::GetBaseAtk() const {
	return GetBaseAtk(true, true);
}
Exemplo n.º 6
0
void Game_Actor::SetBaseAtk(int atk) {
	int new_attack_mod = GetData().attack_mod + (atk - GetBaseAtk());
	GetData().attack_mod = new_attack_mod;
}