public static unsafe void EXP_SingleLine(uint *bmpAddress, int bmpWidth, int bmpHeight, int x, int y, int width, uint exp, byte level, PBESpecies species, PBEForm form) { if (level >= PkmnConstants.MaxLevel) { EXP_SingleLine(bmpAddress, bmpWidth, bmpHeight, x, y, width, 0); return; } PBEGrowthRate gr = BaseStats.Get(species, form, true).GrowthRate; EXP_SingleLine(bmpAddress, bmpWidth, bmpHeight, x, y, width, exp, level, gr); }
public void Debug_Create() { GameStats = new GameStats(); Pokedex = new Pokedex(); Flags = new Flags(); Vars = new Vars(); OT = new OTInfo("Dawn", true); PlayerInventory = Inventory <InventorySlotNew> .CreatePlayerInventory(); PlayerInventory.Add(ItemType.DuskBall, 995); PlayerInventory.Add(ItemType.RockyHelmet, 42); PlayerInventory.Add(ItemType.Leftovers, 473); PlayerInventory.Add(ItemType.Potion, 123); PlayerInventory.Add(ItemType.RedScarf, 230); PlayerInventory.Add(ItemType.PokeDoll, 130); PlayerInventory.Add(ItemType.XSpDef, 120); PlayerInventory.Add(ItemType.AirBalloon, 407); PlayerInventory.Add(ItemType.PokeBall, 73); PlayerInventory.Add(ItemType.DarkGem, 69); PlayerInventory.Add(ItemType.FluffyTail, 888); PlayerInventory.Add(ItemType.OvalCharm, 1); PlayerInventory.Add(ItemType.ShinyCharm, 1); ItemData.Debug_GiveAllTMHMs(PlayerInventory); Money = 473_123; InitPlayerWithDefaultLocation(); PCBoxes = new PCBoxes(); Daycare = new Daycare(); Daycare.StorePokemon(PartyPokemon.CreatePlayerOwnedMon(PBESpecies.Blissey, 0, 47)); Daycare.StorePokemon(PartyPokemon.CreatePlayerOwnedMon(PBESpecies.Ditto, 0, 82)); PlayerParty = new Party(); { // To test evolution var evomon = PartyPokemon.CreatePlayerOwnedMon(PBESpecies.Burmy, PBEForm.Burmy_Trash, 19); evomon.Item = ItemType.Leftovers; evomon.EXP = PBEEXPTables.GetEXPRequired(BaseStats.Get(evomon.Species, evomon.Form, true).GrowthRate, 20) - 1; GivePokemon(evomon); // To pummel var victini = PartyPokemon.CreatePlayerOwnedMon(PBESpecies.Victini, 0, 67); victini.Ability = PBEAbility.Compoundeyes; victini.Item = ItemType.Leftovers; victini.Status1 = PBEStatus1.BadlyPoisoned; victini.Moveset[0].Move = PBEMove.Bounce; victini.Moveset[1].Move = PBEMove.ZenHeadbutt; victini.Moveset[2].Move = PBEMove.Surf; victini.Moveset[3].Move = PBEMove.VCreate; GivePokemon(victini); } for (int i = 0; i < 44; i++) { Debug_GiveRandomPokemon(i == 0 || i == 1 || i == 35); } Overworld.UpdateGiratinaForms(); // Not really necessary, including for debug though }
public void Debug_LevelUpManually(int numTimes) { var bs = BaseStats.Get(Pkmn.Species, Pkmn.Form, true); PBEGrowthRate growthRate = bs.GrowthRate; for (int i = 0; i < numTimes; i++) { uint nextLevelAmt = PBEDataProvider.Instance.GetEXPRequired(growthRate, (byte)(Pkmn.Level + 1)); Pkmn.EXP = nextLevelAmt; Pkmn.Level++; LevelsGained++; TeachNewMoves(); } }
public void IncrementStep() { if (Pkmn.Level >= PkmnConstants.MaxLevel) { return; // Cannot level up anymore } var bs = BaseStats.Get(Pkmn.Species, Pkmn.Form, true); PBEGrowthRate growthRate = bs.GrowthRate; uint nextLevelAmt = PBEDataProvider.Instance.GetEXPRequired(growthRate, (byte)(Pkmn.Level + 1)); if (++Pkmn.EXP < nextLevelAmt) { return; // No level up } Pkmn.Level++; LevelsGained++; TeachNewMoves(); }
private unsafe void DrawStatsPage(uint *bmpAddress, int bmpWidth, int bmpHeight) { const float winX = 0.03f; const float winY = 0.15f; const float winW = 0.97f - winX; const float winH = 0.995f - winY; const float leftColX = winX + 0.02f; const float rightColX = winX + 0.52f; const float rightColY = winY + 0.02f; const float rightColW = 0.95f - rightColX; const float rightColH = 0.535f; const float rightColCenterX = rightColX + (rightColW / 2f); const float textStartY = rightColY + 0.01f; const float textStart2Y = rightColY + 0.13f; const float textSpacingY = 0.08f; const float abilTextY = textStart2Y + (5.5f * textSpacingY); const float abilDescX = leftColX + 0.03f; const float abilDescY = textStart2Y + (6.6f * textSpacingY); const float abilX = winX + 0.18f; const float abilTextX = abilX + 0.03f; const float abilY = abilTextY; const float abilW = 0.95f - abilX; const float abilH = 0.075f; int hpW = (int)(bmpWidth * 0.3f); int hpX = RenderUtils.GetCoordinatesForCentering(bmpWidth, hpW, rightColCenterX); int hpY = (int)(bmpHeight * (rightColY + 0.09f)); RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, winX, winY, winX + winW, winY + winH, 12, RenderUtils.Color(135, 145, 250, 255)); // Stats RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, rightColX, rightColY, rightColX + rightColW, rightColY + rightColH, 8, RenderUtils.Color(210, 210, 210, 255)); // Abil RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, abilX, abilY, abilX + abilW, abilY + abilH, 5, RenderUtils.Color(210, 210, 210, 255)); // Abil desc RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, leftColX, abilDescY, 0.95f, 0.98f, 5, RenderUtils.Color(210, 210, 210, 255)); Font leftColFont = Font.Default; uint[] leftColColors = Font.DefaultWhite_DarkerOutline_I; Font rightColFont = Font.Default; uint[] rightColColors = Font.DefaultBlack_I; uint[] boostedColors = Font.DefaultRed_Lighter_O; uint[] dislikedColors = Font.DefaultCyan_O; void PlaceLeftCol(int i, string leftColStr, bool boosted, bool disliked) { float y; if (i == -1) { y = abilTextY; } else if (i == -2) { y = textStartY; } else { y = textStart2Y + (i * textSpacingY); } uint[] colors; if (boosted) { colors = boostedColors; } else if (disliked) { colors = dislikedColors; } else { colors = leftColColors; } leftColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, leftColX, y, leftColStr, colors); } void PlaceRightCol(int i, string rightColStr, uint[] colors) { float y = i == -2 ? textStartY : textStart2Y + (i * textSpacingY); rightColFont.MeasureString(rightColStr, out int strW, out _); rightColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, RenderUtils.GetCoordinatesForCentering(bmpWidth, strW, rightColCenterX), (int)(bmpHeight * y), rightColStr, colors); } BaseStats bs; PBEAbility abil; PBENature nature; IPBEStatCollection evs; IVs ivs; byte level; ushort hp; ushort maxHP; if (_pPkmn is not null) { bs = BaseStats.Get(_pPkmn.Species, _pPkmn.Form, true); abil = _pPkmn.Ability; nature = _pPkmn.Nature; evs = _pPkmn.EffortValues; ivs = _pPkmn.IndividualValues; level = _pPkmn.Level; hp = _pPkmn.HP; maxHP = _pPkmn.MaxHP; } else if (_pcPkmn is not null) { bs = BaseStats.Get(_pcPkmn.Species, _pcPkmn.Form, true); abil = _pcPkmn.Ability; nature = _pcPkmn.Nature; evs = _pcPkmn.EffortValues; ivs = _pcPkmn.IndividualValues; level = _pcPkmn.Level; hp = maxHP = PBEDataUtils.CalculateStat(bs, PBEStat.HP, nature, evs.GetStat(PBEStat.HP), ivs.HP, level, PkmnConstants.PBESettings); } else { PartyPokemon pPkmn = _bPkmn.PartyPkmn; PBEBattlePokemon bPkmn = _bPkmn.Pkmn; bs = BaseStats.Get(pPkmn.Species, bPkmn.RevertForm, true); abil = pPkmn.Ability; nature = pPkmn.Nature; evs = bPkmn.EffortValues; ivs = pPkmn.IndividualValues; level = bPkmn.Level; hp = bPkmn.HP; maxHP = bPkmn.MaxHP; } ushort atk = PBEDataUtils.CalculateStat(bs, PBEStat.Attack, nature, evs.GetStat(PBEStat.Attack), ivs.Attack, level, PkmnConstants.PBESettings); ushort def = PBEDataUtils.CalculateStat(bs, PBEStat.Defense, nature, evs.GetStat(PBEStat.Defense), ivs.Defense, level, PkmnConstants.PBESettings); ushort spAtk = PBEDataUtils.CalculateStat(bs, PBEStat.SpAttack, nature, evs.GetStat(PBEStat.SpAttack), ivs.SpAttack, level, PkmnConstants.PBESettings); ushort spDef = PBEDataUtils.CalculateStat(bs, PBEStat.SpDefense, nature, evs.GetStat(PBEStat.SpDefense), ivs.SpDefense, level, PkmnConstants.PBESettings); ushort speed = PBEDataUtils.CalculateStat(bs, PBEStat.Speed, nature, evs.GetStat(PBEStat.Speed), ivs.Speed, level, PkmnConstants.PBESettings); PBEStat?favored = nature.GetLikedStat(); PBEStat?disliked = nature.GetDislikedStat(); PlaceLeftCol(-2, "HP", false, false); PlaceLeftCol(0, "Attack", favored == PBEStat.Attack, disliked == PBEStat.Attack); PlaceLeftCol(1, "Defense", favored == PBEStat.Defense, disliked == PBEStat.Defense); PlaceLeftCol(2, "Special Attack", favored == PBEStat.SpAttack, disliked == PBEStat.SpAttack); PlaceLeftCol(3, "Special Defense", favored == PBEStat.SpDefense, disliked == PBEStat.SpDefense); PlaceLeftCol(4, "Speed", favored == PBEStat.Speed, disliked == PBEStat.Speed); PlaceLeftCol(-1, "Ability", false, false); // HP string str = string.Format("{0}/{1}", hp, maxHP); PlaceRightCol(-2, str, rightColColors); double percent = (double)hp / maxHP; RenderUtils.HP_TripleLine(bmpAddress, bmpWidth, bmpHeight, hpX, hpY, hpW, percent); // Attack str = atk.ToString(); PlaceRightCol(0, str, rightColColors); // Defense str = def.ToString(); PlaceRightCol(1, str, rightColColors); // Sp. Attack str = spAtk.ToString(); PlaceRightCol(2, str, rightColColors); // Sp. Defense str = spDef.ToString(); PlaceRightCol(3, str, rightColColors); // Speed str = speed.ToString(); PlaceRightCol(4, str, rightColColors); // Ability str = PBELocalizedString.GetAbilityName(abil).English; rightColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, abilTextX, abilTextY, str, rightColColors); // Ability desc str = PBELocalizedString.GetAbilityDescription(abil).English; leftColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, abilDescX, abilDescY, str, rightColColors); }
private unsafe void DrawInfoPage(uint *bmpAddress, int bmpWidth, int bmpHeight) { const float winX = 0.03f; const float winY = 0.15f; const float winW = 0.97f - winX; const float winH = 0.85f - winY; const float leftColX = winX + 0.02f; const float rightColX = winX + 0.52f; const float rightColY = winY + 0.03f; const float rightColW = 0.95f - rightColX; const float rightColH = 0.82f - rightColY; const float rightColCenterX = rightColX + (rightColW / 2f); const float textStartY = rightColY + 0.02f; const float textSpacingY = 0.1f; int xpW = (int)(bmpWidth * 0.3f); int xpX = RenderUtils.GetCoordinatesForCentering(bmpWidth, xpW, rightColCenterX); int xpY = (int)(bmpHeight * (rightColY + 0.61f)); RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, winX, winY, winX + winW, winY + winH, 15, RenderUtils.Color(128, 215, 135, 255)); RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, rightColX, rightColY, rightColX + rightColW, rightColY + rightColH, 8, RenderUtils.Color(210, 210, 210, 255)); Font leftColFont = Font.Default; uint[] leftColColors = Font.DefaultWhite_DarkerOutline_I; Font rightColFont = Font.Default; uint[] rightColColors = Font.DefaultBlack_I; void PlaceLeftCol(int i, string leftColStr) { float y = textStartY + (i * textSpacingY); leftColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, leftColX, y, leftColStr, leftColColors); } void PlaceRightCol(int i, string rightColStr, uint[] colors) { float y = textStartY + (i * textSpacingY); rightColFont.MeasureString(rightColStr, out int strW, out _); rightColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, RenderUtils.GetCoordinatesForCentering(bmpWidth, strW, rightColCenterX), (int)(bmpHeight * y), rightColStr, colors); } PlaceLeftCol(0, "Species"); PlaceLeftCol(1, "Type(s)"); PlaceLeftCol(2, "OT"); PlaceLeftCol(3, "OT ID"); PlaceLeftCol(4, "Exp. Points"); PlaceLeftCol(5, "Exp. To Next Level"); PBESpecies species; PBEForm form; OTInfo ot; byte level; uint exp; if (_pPkmn is not null) { species = _pPkmn.Species; form = _pPkmn.Form; ot = _pPkmn.OT; level = _pPkmn.Level; exp = _pPkmn.EXP; } else if (_pcPkmn is not null) { species = _pcPkmn.Species; form = _pcPkmn.Form; ot = _pcPkmn.OT; level = _pcPkmn.Level; exp = _pcPkmn.EXP; } else { PartyPokemon pPkmn = _bPkmn.PartyPkmn; PBEBattlePokemon bPkmn = _bPkmn.Pkmn; species = pPkmn.Species; form = bPkmn.RevertForm; ot = pPkmn.OT; level = bPkmn.Level; exp = bPkmn.EXP; } var bs = BaseStats.Get(species, form, true); uint toNextLvl; if (level >= PkmnConstants.MaxLevel) { toNextLvl = 0; RenderUtils.EXP_SingleLine(bmpAddress, bmpWidth, bmpHeight, xpX, xpY, xpW, 0); } else { PBEGrowthRate gr = bs.GrowthRate; toNextLvl = PBEEXPTables.GetEXPRequired(gr, (byte)(level + 1)) - exp; RenderUtils.EXP_SingleLine(bmpAddress, bmpWidth, bmpHeight, xpX, xpY, xpW, exp, level, gr); } // Species string str = PBELocalizedString.GetSpeciesName(species).English; PlaceRightCol(0, str, rightColColors); // Types str = PBELocalizedString.GetTypeName(bs.Type1).English; if (bs.Type2 != PBEType.None) { str += ' ' + PBELocalizedString.GetTypeName(bs.Type2).English; } PlaceRightCol(1, str, rightColColors); // OT str = ot.TrainerName; PlaceRightCol(2, str, ot.TrainerIsFemale ? Font.DefaultRed_I : Font.DefaultBlue_I); // OT ID str = ot.TrainerID.ToString(); PlaceRightCol(3, str, rightColColors); // Exp str = exp.ToString(); PlaceRightCol(4, str, rightColColors); // To next level str = toNextLvl.ToString(); PlaceRightCol(5, str, rightColColors); }