示例#1
0
 SIZE SSkinImgFrame2::GetSkinSize()
 {
     CSize szImg = m_rcImg.Size();
     if(IsVertical()) szImg.cy /= GetStates();
     else szImg.cx /= GetStates();
     return szImg;
 }
示例#2
0
std::vector<int16_t> Game_Battler::GetInflictedStates() const {
	std::vector<int16_t> states;
	for (size_t i = 0; i < GetStates().size(); ++i) {
		if (GetStates()[i] > 0) {
			states.push_back(Data::states[i].ID);
		}
	}
	return states;
}
示例#3
0
void Game_Battler::AddState(int state_id) {
	std::vector<int16_t>& states = GetStates();
	if (state_id > 0 && !HasState(state_id)) {
		states.push_back(state_id);
		std::sort(states.begin(), states.end());
	}
}
示例#4
0
void CPhilipsHue::Do_Work()
{
	int msec_counter = 0;
	int sec_counter = HUE_POLL_INTERVAL-2;

	_log.Log(LOG_STATUS,"Philips Hue: Worker started...");

	while (!m_stoprequested)
	{
		sleep_milliseconds(500);

		msec_counter++;
		if (msec_counter == 2)
		{
			msec_counter = 0;
			sec_counter++;
			if (sec_counter % HUE_POLL_INTERVAL == 0)
			{
				m_LastHeartbeat = mytime(NULL);
				GetStates();
			}
		}
	}
	_log.Log(LOG_STATUS,"Philips Hue: Worker stopped...");
}
void Game_Battler::RemoveBattleStates() {
	std::vector<int16_t>& states = GetStates();
	for (size_t i = 0; i < states.size(); ++i) {
		if (non_permanent(i + 1) || ReaderUtil::GetElement(Data::states, i + 1)->auto_release_prob > 0) {
			RemoveState(i + 1);
		}
	}
}
示例#6
0
	QStringList ProxyObject::GetCustomStatusNames () const
	{
		const auto mgr = Core::Instance ().GetCustomStatusesManager ();

		QStringList result;
		for (const auto& status : mgr->GetStates ())
			result << status.Name_;
		return result;
	}
示例#7
0
	boost::optional<CustomStatus> ProxyObject::FindCustomStatus (const QString& name) const
	{
		const auto mgr = Core::Instance ().GetCustomStatusesManager ();
		const auto& statuses = mgr->GetStates ();

		const auto pos = std::find_if (statuses.begin (), statuses.end (),
				[&name] (const CustomStatus& status)
					{ return !QString::compare (status.Name_, name, Qt::CaseInsensitive); });
		if (pos == statuses.end ())
			return {};
		return *pos;
	}
示例#8
0
void Game_Battler::RemoveState(int state_id) {
	if (state_id <= 0) {
		return;
	}

	std::vector<int16_t>& states = GetStates();
	if (state_id - 1 >= states.size()) {
		return;
	}

	states[state_id - 1] = 0;
}
示例#9
0
void Game_Battler::AddState(int state_id) {
	if (state_id <= 0) {
		return;
	}

	std::vector<int16_t>& states = GetStates();
	if (state_id - 1 >= states.size()) {
		states.resize(state_id);
	}

	states[state_id - 1] = 1;
}
示例#10
0
void Game_Battler::RemoveState(int state_id) {
	const RPG::State* state = ReaderUtil::GetElement(Data::states, state_id);
	if (!state) {
		Output::Warning("RemoveState: Can't delete state with invalid ID %d", state_id);
		return;
	}

	std::vector<int16_t>& states = GetStates();
	if (state_id - 1 >= static_cast<int>(states.size())) {
		return;
	}

	states[state_id - 1] = 0;
}
示例#11
0
void Game_Battler::RemoveBattleStates() {
	std::vector<int16_t>& states = GetStates();

	// If death is non-permanent change HP to 1
	if (IsDead() &&
		non_permanent(1)) {
		ChangeHp(1);
	}

	for (size_t i = 0; i < states.size(); ++i) {
		if (non_permanent(i + 1)) {
			states[i] = 0;
		}
	}
}
示例#12
0
int Game_Battler::GetAgi() const {
	int base_agi = GetBaseAgi();
	int n = min(max(base_agi, 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_agility) {
			n = AffectParameter(Data::states[(*i)].affect_type, base_agi);
			break;
		}
	}

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

	return n;
}
示例#13
0
int Game_Battler::GetDef() const {
	int base_def = GetBaseDef();
	int n = min(max(base_def, 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_defense) {
			n = AffectParameter(Data::states[(*i)].affect_type, base_def);
			break;
		}
	}

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

	return n;
}
示例#14
0
void Game_Battler::AddState(int state_id) {
	const RPG::State* state = ReaderUtil::GetElement(Data::states, state_id);
	if (!state) {
		Output::Warning("AddState: Can't add state with invalid ID %d", state_id);
		return;
	}

	if (IsDead()) {
		return;
	}
	if (state_id == 1) {
		SetGauge(0);
		RemoveAllStates();
		SetCharged(false);
		SetHp(0);
		SetAtkModifier(0);
		SetDefModifier(0);
		SetSpiModifier(0);
		SetAgiModifier(0);
		SetIsDefending(false);
		SetCharged(false);
		attribute_shift.clear();
		attribute_shift.resize(Data::attributes.size());
	}

	std::vector<int16_t>& states = GetStates();
	if (state_id - 1 >= static_cast<int>(states.size())) {
		states.resize(state_id);
	}

	states[state_id - 1] = 1;

	// Clear states that are more than 10 priority points below the
	// significant state
	const RPG::State* sig_state = GetSignificantState();

	for (size_t i = 0; i < states.size(); ++i) {
		if (Data::states[i].priority <= sig_state->priority - 10) {
			states[i] = 0;
		}
	}

	if (IsDefending() && GetSignificantRestriction() != RPG::State::Restriction_normal) {
		SetIsDefending(false);
	}
}
示例#15
0
//
// Entry point of this driver.
//
EFI_STATUS
EFIAPI
SmmAccess2DxeEntryPoint (
  IN EFI_HANDLE       ImageHandle,
  IN EFI_SYSTEM_TABLE *SystemTable
  )
{
  //
  // This module should only be included if SMRAM support is required.
  //
  ASSERT (FeaturePcdGet (PcdSmmSmramRequire));

  InitQ35TsegMbytes ();
  GetStates (&mAccess2.LockState, &mAccess2.OpenState);
  return gBS->InstallMultipleProtocolInterfaces (&ImageHandle,
                &gEfiSmmAccess2ProtocolGuid, &mAccess2,
                NULL);
}
示例#16
0
std::vector<int16_t> Game_Battler::BattleStateHeal() {
	std::vector<int16_t> healed_states;
	std::vector<int16_t>& states = GetStates();

	for (size_t i = 0; i < states.size(); ++i) {
		if (HasState(i + 1)) {
			if (states[i] > Data::states[i].hold_turn
					&& Utils::ChanceOf(Data::states[i].auto_release_prob, 100)) {
				healed_states.push_back(i + 1);
				RemoveState(i + 1);
			} else {
				++states[i];
			}
		}
	}

	return healed_states;
}
示例#17
0
const RPG::State* Game_Battler::GetState() {
	int priority = 0;
	const RPG::State* the_state = NULL;

	const std::vector<int16_t>& states = GetStates();
	for (int i = 0; i < (int) states.size(); i++) {
		const RPG::State* state = &Data::states[states[i]];
		// Death has highest priority
		if (state->ID == 1)
			return state;

		if (state->priority > priority) {
			the_state = state;
			priority = state->priority;
		}
	}

	return the_state;
}
示例#18
0
std::vector<int16_t> Game_Battler::BattlePhysicalStateHeal(int physical_rate) {
	std::vector<int16_t> healed_states;
	std::vector<int16_t>& states = GetStates();

	if (physical_rate <= 0) {
		return healed_states;
	}

	for (size_t i = 0; i < states.size(); ++i) {
		if (HasState(i + 1) && Data::states[i].release_by_damage > 0) {
			int release_chance = (int)(Data::states[i].release_by_damage * physical_rate / 100.0);

			if (Utils::ChanceOf(release_chance, 100)) {
				healed_states.push_back(i + 1);
			}
		}
	}

	return healed_states;
}
示例#19
0
std::vector<int16_t> Game_Battler::NextBattleTurn() {
	++battle_turn;

	std::vector<int16_t> healed_states;
	std::vector<int16_t>& states = GetStates();

	for (size_t i = 0; i < states.size(); ++i) {
		if (HasState(i + 1)) {
			states[i] += 1;

			if (states[i] >= Data::states[i].hold_turn) {
				if (Utils::ChanceOf(Data::states[i].auto_release_prob, 100)) {
					healed_states.push_back(i + 1);
					RemoveState(i + 1);
				}
			}
		}
	}

	return healed_states;
}
示例#20
0
void Game_Actor::RemoveInvalidData() {
	/*
	 The following actor data is cleaned up:
	 - Invalid equipment is removed
	 - An invalid class is removed
	 - Invalid states are removed
	 - Level is between 0 and 99, and does not exceed MaxLevel

	 For "external data" (not from LCF Actor or LSD SaveActor) the data is
	 verified in the corresponding functions.
	*/

	// Filter out invalid equipment
	int eq_types[] = { RPG::Item::Type_weapon,
		HasTwoWeapons() ? RPG::Item::Type_weapon : RPG::Item::Type_shield,
		RPG::Item::Type_armor,
		RPG::Item::Type_helmet,
		RPG::Item::Type_accessory
	};

	auto& equipment = GetWholeEquipment();
	for (size_t i = 0; i < equipment.size(); ++i) {
		int eq_id = equipment[i];
		RPG::Item* item = ReaderUtil::GetElement(Data::items, eq_id);

		if (!item && eq_id != 0) {
			Output::Debug("Actor %d: Removing invalid item %d from equipment slot %d",
			GetId(), eq_id, eq_types[i]);
			SetEquipment(i + 1, 0);
		} else if (item && item->type != eq_types[i]) {
			Output::Debug("Actor %d: Removing item %d (of type %d) from equipment slot %d (needs type %d)",
			GetId(), item->ID, item->type, i + 1, eq_types[i]);
			SetEquipment(i + 1, 0);
		} else if (item && !IsItemUsable(item->ID)) {
			Output::Debug("Actor %d: Removing item %d from equipment slot %d (Not equippable by this actor)",
			GetId(), item->ID, i + 1);
			SetEquipment(i + 1, 0);
		}
	}

	// Remove invalid class
	if (GetData().class_id > 0) {
		const RPG::Class* cls = ReaderUtil::GetElement(Data::classes, GetData().class_id);
		if (!cls) {
			Output::Warning("Actor %d: Removing invalid class %d", GetId(), GetData().class_id);
			SetClass(0);
		}
	}

	// Remove invalid skills
	for (int16_t skill_id : GetSkills()) {
		const RPG::Skill* skill = ReaderUtil::GetElement(Data::skills, skill_id);
		if (!skill) {
			Output::Warning("Actor %d: Removing invalid skill %d", GetId(), skill_id);
			UnlearnSkill(skill_id);
		}
	}

	// Remove invalid states
	if (GetStates().size() > Data::states.size()) {
		Output::Warning("Actor %d: State array contains invalid states (%d > %d)", GetId(), GetStates().size(), Data::states.size());
		GetStates().resize(Data::states.size());
	}

	// Remove invalid levels
	// Special handling for the game COLORS: Lost Memories which uses level 0
	// through database editing. Hopefully no game uses negative levels.
	if (GetLevel() == 0) {
		Output::Debug("Actor %d: Special handling for level 0", GetId());
	} else if (GetLevel() < 0) {
		Output::Warning("Actor %d: Invalid level %d, changed to 1", GetId(), GetLevel());
		SetLevel(1);
	} else if (GetLevel() > GetMaxLevel()) {
		Output::Warning("Actor %d: Invalid level %d, changed to %d", GetId(), GetLevel(), GetMaxLevel());
		SetLevel(GetMaxLevel());
	}
}
示例#21
0
bool Game_Battler::HasState(int state_id) const {
	return (std::find(GetStates().begin(), GetStates().end(), state_id) != GetStates().end());
}
示例#22
0
void Game_Battler::RemoveAllStates() {
	std::vector<int16_t>& states = GetStates();
	states.clear();
}
示例#23
0
void Game_Battler::RemoveStates() {
	std::vector<int16_t>& states = GetStates();
	std::vector<int16_t>::iterator end = std::remove_if(states.begin(), states.end(), NonPermanent);
	states.erase(end, states.end());
}
示例#24
0
void Game_Battler::RemoveState(int state_id) {
	std::vector<int16_t>& states = GetStates();
	std::vector<int16_t>::iterator it = std::find(states.begin(), states.end(), state_id);
	if (it != states.end())
		states.erase(it);
}
示例#25
0
文件: SSkin.cpp 项目: 435420057/soui
BOOL SSkinImgList::IgnoreState()
{
    return GetStates()==1;
}