Example #1
0
void Game_Actor::ChangeLevel(int new_level, bool level_up_message) {
	const std::vector<RPG::Learning>* skills;
	if (GetData().class_id > 0) {
		skills = &GetClass()->skills;
	} else {
		skills = &GetActor().skills;
	}

	bool level_up = false;

	int old_level = GetLevel();
	SetLevel(new_level);
	new_level = GetLevel(); // Level adjusted to max

	if (new_level > old_level) {
		if (level_up_message) {
			Game_Message::texts.push_back(GetLevelUpMessage(new_level));
			level_up = true;
		}

		// Learn new skills
		for (const RPG::Learning& learn : *skills) {
			// Skill learning, up to current level
			if (learn.level > old_level && learn.level <= new_level) {
				LearnSkill(learn.skill_id);
				if (level_up_message) {
					Game_Message::texts.push_back(GetLearningMessage(learn));
					level_up = true;
				}
			}
		}

		if (level_up) {
			Game_Message::texts.back().append("\f");
			Game_Message::message_waiting = true;
		}

		// Experience adjustment:
		// At least level minimum
		SetExp(max(GetBaseExp(), GetExp()));
	} else if (new_level < old_level) {
		// Experience adjustment:
		// Level minimum if higher then Level maximum
		if (GetExp() >= GetNextExp()) {
			SetExp(GetBaseExp());
		}
	}
}
Example #2
0
void Game_Actor::ChangeExp(int exp, bool level_up_message) {
	int new_level = GetLevel();
	int new_exp = min(max(exp, 0), max_exp_value());

	if (new_exp > GetExp()) {
		for (int i = GetLevel() + 1; i <= GetMaxLevel(); ++i) {
			if (GetNextExp(new_level) != -1 && GetNextExp(new_level) > new_exp) {
				break;
			}
			new_level++;
		}
	} else if (new_exp < GetExp()) {
		for (int i = GetLevel(); i > 1; --i) {
			if (new_exp >= GetNextExp(i - 1)) {
				break;
			}
			new_level--;
		}
	}

	SetExp(new_exp);

	if (new_level != GetLevel()) {
		ChangeLevel(new_level, level_up_message);
	}
}
Example #3
0
void Game_Actor::Init() {
	const std::vector<RPG::Learning>& skills = Data::actors[data.ID - 1].skills;
	for (int i = 0; i < (int) skills.size(); i++)
		if (skills[i].level <= GetLevel())
			LearnSkill(skills[i].skill_id);
	SetHp(GetMaxHp());
	SetSp(GetMaxSp());
	SetExp(exp_list[GetLevel() - 1]);
}
Example #4
0
// --- Methods inherited from Tex3D ---
void Smoke::ReadSXPData(const TCHAR *name, void *sxpdata) {
	SmokeState *state = (SmokeState*)sxpdata;
	if (state != NULL && (state->version == SMOKE_SXP_VERSION)) {
		SetColor(0, ColorFromCol24(state->col1), TimeValue(0));
		SetColor(1, ColorFromCol24(state->col2), TimeValue(0));
		//SetSpeed(state->speed, TimeValue(0));
		SetPhase(0.0f, TimeValue(0));
		SetSize(state->size, TimeValue(0));
		SetIter(state->nits, TimeValue(0));
		SetExp(state->power, TimeValue(0));
	}
}
Example #5
0
void CCharacter::AddExp(int exp) {
	if(m_mexp == 0)
		printf_s("Error\n");
	if(m_exp + exp > m_mexp) {
		int extraExp = m_exp + exp - m_mexp;
		LevelUp();
		AddExp(extraExp);
	} else if(m_exp + exp == m_mexp) {
		LevelUp();
	} else {
		SetExp(m_exp + exp);
	}
}
Example #6
0
void Game_Actor::Init() {
	const std::vector<RPG::Learning>& skills = GetActor().skills;
	for (int i = 0; i < (int)skills.size(); i++) {
		if (skills[i].level <= GetLevel()) {
			LearnSkill(skills[i].skill_id);
		}
	}

	RemoveInvalidData();

	if (GetLevel() > 0) {
		SetHp(GetMaxHp());
		SetSp(GetMaxSp());
		SetExp(exp_list[GetLevel() - 1]);
	}

	AddEquipmentStates();
}
Example #7
0
void Game_Actor::SetClass(int _class_id) {
	if (_class_id != 0) {
		const RPG::Class* cls = ReaderUtil::GetElement(Data::classes, _class_id);

		if (!cls) {
			Output::Warning("Actor %d: Can't change to invalid class %d", GetId(), _class_id);
			return;
		}
	}

	GetData().class_id = _class_id;
	GetData().changed_battle_commands = true; // Any change counts as a battle commands change.

	// The class settings are not applied when the actor has a class on startup
	// but only when the "Change Class" event command is used.

	if (_class_id > 0) {
		GetData().super_guard = GetClass()->super_guard;
		GetData().lock_equipment = GetClass()->lock_equipment;
		GetData().two_weapon = GetClass()->two_weapon;
		GetData().auto_battle = GetClass()->auto_battle;

		GetData().battler_animation = GetClass()->battler_animation;

		GetData().battle_commands = GetClass()->battle_commands;
	} else {
		GetData().super_guard = GetActor().super_guard;
		GetData().lock_equipment = GetActor().lock_equipment;
		GetData().two_weapon = GetActor().two_weapon;
		GetData().auto_battle = GetActor().auto_battle;

		GetData().battler_animation = 0;

		GetData().battle_commands = GetActor().battle_commands;
	}
	MakeExpList();

	// Set EXP to at least minimum value
	if (GetExp() < GetBaseExp()) {
		SetExp(GetBaseExp());
	}
}
Example #8
0
// This method is called to reset the texmap back to its default values.
void Smoke::Init() {
	// Reset the XYZGen or allocate a new one
	if (xyzGen) 
		xyzGen->Reset();
	else 
		ReplaceReference(0, GetNewDefaultXYZGen());	

	// Set the inital parameters
	SetColor(0, Color(0.0f, 0.0f, 0.0f), TimeValue(0));
	SetColor(1, Color(0.9f, 0.9f, 0.9f), TimeValue(0));
	SetExp(1.5f, TimeValue(0));
	SetIter(5, TimeValue(0));

    RegisterDistanceDefault(_T("Smoke Params"), _T("Size"), 40.0f, IN_TO_M(40.0f));
    float size = GetDistanceDefault(_T("Smoke Params"), _T("Size"));
    SetSize(size, TimeValue(0));

	SetPhase(0.0f, TimeValue(0));
	seed = 0x8563;

	// Set the validity interval of the texture to empty
	texValidity.SetEmpty();
	mapValid.SetEmpty();
	}
Example #9
0
void CMemPmBasicPage::TransData(BOOL bToControls)
{
    DWORD	dwNum;
    CString	szText;
    WORD	wBreed;

    m_ppc = GetPokemonCodec();
    if(m_ppc == NULL)
        return;

    if(bToControls)
    {
        ////////////////////////////////////////////////
        m_ctrlBreedList.SetImageList(g_MemRom.m_pTinyIconList);
        COMBOBOXEXITEM	cbei;
        cbei.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;

        for(wBreed = 0; wBreed < BREED_COUNT; ++wBreed)
        {
            cbei.iItem = wBreed;
            cbei.iImage = g_MemRom.GetSmallIconIndex(wBreed, rand() % g_MemRom.GetSmallIconCount(wBreed));
            cbei.iSelectedImage = cbei.iImage;
            m_ctrlBreedList.SetItem(&cbei);
        }

        OnBnClickedEnableText();

        SetBreed();

        szText.Format(_T("0x%08lX"), m_ppc->GetChar());
        SetDlgItemText(IDC_CHAR, szText);

        szText.Format(_T("0x%08lX"), m_ppc->GetID());
        SetDlgItemText(IDC_ID, szText);

        SetExp();

        SetDlgItemInt(IDC_INTIMATE, m_ppc->GetIntimate(), FALSE);

        SetPs();

        m_ctrlItemList.SetCurSel(m_ppc->GetItem());
        SetItemDesc();

        CheckDlgButton(IDC_EGG, m_ppc->GetIsEgg() ? BST_CHECKED : BST_UNCHECKED);

        CheckDlgButton(IDC_SHINY, m_ppc->GetIsShiny() ? BST_CHECKED : BST_UNCHECKED);

        CheckDlgButton(IDC_OBEDIENCE, m_ppc->GetObedience() ? BST_CHECKED : BST_UNCHECKED);
    }
    else
    {
        GetDlgItemText(IDC_INTIMATE, szText);
        dwNum = min(_tcstoul(szText, 0, 0), 0xFF);
        m_ppc->SetIntimate((BYTE)(dwNum));

        if(IsDlgButtonChecked(IDC_ENABLE_TEXT) == BST_CHECKED)
        {
            GetDlgItemText(IDC_NICK_NAME, szText);
            m_ppc->SetNickName(szText);

            GetDlgItemText(IDC_CATCHER_NAME, szText);
            m_ppc->SetCatcherName(szText);
        }
    }
}