public unsafe void UpdateInfoBar() { fixed(uint *bmpAddress = InfoBarImg.Bitmap) { RenderUtils.OverwriteRectangle(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, RenderUtils.Color(48, 48, 48, 128)); // Nickname Font.DefaultSmall.DrawString(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, 2, 3, Pkmn.KnownNickname, Font.DefaultWhite_I); // Gender PBEGender gender = _useKnownInfo && !Pkmn.KnownStatus2.HasFlag(PBEStatus2.Transformed) ? Pkmn.KnownGender : Pkmn.Gender; if (gender != PBEGender.Genderless) { Font.Default.DrawString(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, 51, -2, gender.ToSymbol(), gender == PBEGender.Male ? Font.DefaultBlue_O : Font.DefaultRed_O); } // Level const int lvX = 62; Font.PartyNumbers.DrawString(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, lvX, 3, "[LV]", Font.DefaultWhite_I); Font.PartyNumbers.DrawString(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, lvX + 12, 3, Pkmn.Level.ToString(), Font.DefaultWhite_I); // Caught if (_useKnownInfo && Pkmn.IsWild && Game.Instance.Save.Pokedex.IsCaught(Pkmn.KnownSpecies)) { Font.Default.DrawString(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, 2, 12, "*", Font.DefaultRed_O); } // Status PBEStatus1 status = Pkmn.Status1; if (status != PBEStatus1.None) { Font.DefaultSmall.DrawString(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, 30, 13, status.ToString(), Font.DefaultWhite_I); } // HP if (!_useKnownInfo) { string str = Pkmn.HP.ToString(); Font.PartyNumbers.MeasureString(str, out int strW, out int _); Font.PartyNumbers.DrawString(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, 45 - strW, 28, str, Font.DefaultWhite_I); Font.PartyNumbers.DrawString(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, 46, 28, "/" + Pkmn.MaxHP, Font.DefaultWhite_I); } const int lineStartX = 9; const int lineW = 82; RenderUtils.HP_TripleLine(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, lineStartX, 23, lineW, Pkmn.HPPercentage); // EXP if (!_useKnownInfo) { RenderUtils.EXP_SingleLine(bmpAddress, InfoBarImg.Width, InfoBarImg.Height, lineStartX, 37, lineW, Pkmn.EXP, Pkmn.Level, Pkmn.Species, Pkmn.RevertForm); } } }
public PBEStatus1Packet(PBEPokemon status1Receiver, PBEPokemon pokemon2, PBEStatus1 status1, PBEStatusAction statusAction) { var bytes = new List <byte>(); bytes.AddRange(BitConverter.GetBytes(Code)); bytes.Add((byte)(Status1Receiver = status1Receiver.FieldPosition)); bytes.Add((Status1ReceiverTeam = status1Receiver.Team).Id); bytes.Add((byte)(Pokemon2 = pokemon2.FieldPosition)); bytes.Add((Pokemon2Team = pokemon2.Team).Id); bytes.Add((byte)(Status1 = status1)); bytes.Add((byte)(StatusAction = statusAction)); Buffer = BitConverter.GetBytes((short)bytes.Count).Concat(bytes); }
internal PBEStatus1Packet(PBEPokemon status1Receiver, PBEPokemon pokemon2, PBEStatus1 status1, PBEStatusAction statusAction) { var bytes = new List <byte>(); bytes.AddRange(BitConverter.GetBytes(Code)); bytes.Add((byte)(Status1Receiver = status1Receiver.FieldPosition)); bytes.Add((Status1ReceiverTeam = status1Receiver.Team).Id); bytes.Add((byte)(Pokemon2 = pokemon2.FieldPosition)); bytes.Add((Pokemon2Team = pokemon2.Team).Id); bytes.Add((byte)(Status1 = status1)); bytes.Add((byte)(StatusAction = statusAction)); bytes.InsertRange(0, BitConverter.GetBytes((short)bytes.Count)); Buffer = new ReadOnlyCollection <byte>(bytes); }
internal PBEStatus1Packet(PBEPokemon status1Receiver, PBEPokemon pokemon2, PBEStatus1 status1, PBEStatusAction statusAction) { using (var ms = new MemoryStream()) using (var w = new EndianBinaryWriter(ms, encoding: EncodingType.UTF16)) { w.Write(Code); w.Write(Status1Receiver = status1Receiver.FieldPosition); w.Write((Status1ReceiverTeam = status1Receiver.Team).Id); w.Write(Pokemon2 = pokemon2.FieldPosition); w.Write((Pokemon2Team = pokemon2.Team).Id); w.Write(Status1 = status1); w.Write(StatusAction = statusAction); Data = new ReadOnlyCollection <byte>(ms.ToArray()); } }
internal PBESwitchInInfo(byte pkmnId, byte disguisedAsId, PBESpecies species, string nickname, byte level, bool shiny, PBEGender gender, ushort hp, ushort maxHP, double hpPercentage, PBEStatus1 status1, PBEFieldPosition fieldPosition) { PokemonId = pkmnId; DisguisedAsId = disguisedAsId; Species = species; Nickname = nickname; Level = level; Shiny = shiny; Gender = gender; HP = hp; MaxHP = maxHP; HPPercentage = hpPercentage; Status1 = status1; FieldPosition = fieldPosition; }
public void UpdateAnimationSpeed() { PBEBattlePokemon pkmn = Pkmn; PBEStatus1 s = pkmn.Status1; if (s == PBEStatus1.Frozen) { AnimImage.IsPaused = true; } else { AnimImage.SpeedModifier = s == PBEStatus1.Paralyzed || s == PBEStatus1.Asleep || pkmn.HPPercentage <= 0.25 ? 2d : 1d; AnimImage.IsPaused = false; } }
private unsafe void DrawBackground(uint *bmpAddress, int bmpWidth, int bmpHeight) { RenderUtils.OverwriteRectangle(bmpAddress, bmpWidth, bmpHeight, _color); // Shadow RenderUtils.FillEllipse_Points(bmpAddress, bmpWidth, bmpHeight, 3, 34, 29, 39, RenderUtils.Color(0, 0, 0, 100)); // Nickname PartyPokemon p = _usePartyPkmn ? _partyPkmn : _battlePkmn.PartyPkmn; Font.DefaultSmall.DrawString(bmpAddress, bmpWidth, bmpHeight, 2, 3, p.Nickname, Font.DefaultWhite_I); if (p.IsEgg) { return; } PBEBattlePokemon bPkmn = _usePartyPkmn ? null : _battlePkmn.Pkmn; // Gender PBEGender gender = p.Gender; if (gender != PBEGender.Genderless) { Font.Default.DrawString(bmpAddress, bmpWidth, bmpHeight, 61, -2, gender.ToSymbol(), gender == PBEGender.Male ? Font.DefaultBlue_O : Font.DefaultRed_O); } // Level const int lvX = 72; Font.PartyNumbers.DrawString(bmpAddress, bmpWidth, bmpHeight, lvX, 3, "[LV]", Font.DefaultWhite_I); Font.PartyNumbers.DrawString(bmpAddress, bmpWidth, bmpHeight, lvX + 12, 3, (_usePartyPkmn ? p.Level : bPkmn.Level).ToString(), Font.DefaultWhite_I); // Status PBEStatus1 status = _usePartyPkmn ? p.Status1 : bPkmn.Status1; if (status != PBEStatus1.None) { Font.DefaultSmall.DrawString(bmpAddress, bmpWidth, bmpHeight, 61, 13, status.ToString(), Font.DefaultWhite_I); } // Item ItemType item = _usePartyPkmn ? p.Item : (ItemType)bPkmn.Item; if (item != ItemType.None) { Font.DefaultSmall.DrawString(bmpAddress, bmpWidth, bmpHeight, 61, 23, ItemData.GetItemName(item), Font.DefaultWhite_I); } }
public static bool VerifyStatus1Happened(this PBEBattle battle, PBEBattlePokemon status1Receiver, PBEBattlePokemon pokemon2, PBEStatus1 status1, PBEStatusAction statusAction) { foreach (IPBEPacket packet in battle.Events) { if (packet is PBEStatus1Packet s1p && s1p.Status1 == status1 && s1p.StatusAction == statusAction && s1p.Status1ReceiverTrainer.TryGetPokemon(s1p.Status1Receiver) == status1Receiver && s1p.Pokemon2Trainer.TryGetPokemon(s1p.Pokemon2) == pokemon2) { return(true); } } return(false); }