public ChangeMarkingsWindow(IPokemon pokemon) { InitializeComponent(); this.markings = pokemon.Markings; this.pokemon = pokemon; this.circleHitBox.Tag = this.markCircle; this.squareHitBox.Tag = this.markSquare; this.triangleHitBox.Tag = this.markTriangle; this.heartHitBox.Tag = this.markHeart; this.markCircle.Tag = MarkingFlags.Circle; this.markSquare.Tag = MarkingFlags.Square; this.markTriangle.Tag = MarkingFlags.Triangle; this.markHeart.Tag = MarkingFlags.Heart; this.markedBrush = new SolidColorBrush(Color.FromRgb(0, 0, 0)); this.markedHoverBrush = new SolidColorBrush(Color.FromRgb(120, 120, 120)); this.unmarkedBrush = new SolidColorBrush(Color.FromRgb(170, 170, 170)); this.unmarkedHoverBrush = new SolidColorBrush(Color.FromRgb(220, 220, 220)); this.markCircle.Foreground = (pokemon.IsCircleMarked ? markedBrush : unmarkedBrush); this.markSquare.Foreground = (pokemon.IsSquareMarked ? markedBrush : unmarkedBrush); this.markTriangle.Foreground = (pokemon.IsTriangleMarked ? markedBrush : unmarkedBrush); this.markHeart.Foreground = (pokemon.IsHeartMarked ? markedBrush : unmarkedBrush); }
public RelearnMoveWindow(IPokemon pokemon) { InitializeComponent(); this.pokemon = pokemon; ushort[] moves = PokemonDatabase.GetRelearnableMoves(pokemon); foreach (ushort moveID in moves) { Move move = new Move(moveID); ListViewItem listViewItem = new ListViewItem(); Grid grid = new Grid(); grid.Width = 321; grid.Height = 27; Rectangle panel = new Rectangle(); panel.Margin = new Thickness(1, 1, 0, 0); panel.Width = 319; panel.Height = 23; panel.RadiusX = 2; panel.RadiusY = 2; panel.Fill = new SolidColorBrush(Color.FromRgb(248, 248, 248)); panel.Stroke = new SolidColorBrush(Color.FromRgb(0, 0, 0)); panel.StrokeThickness = 1; PokemonTypeControl type = new PokemonTypeControl(); type.Type = move.MoveData.Type; type.Margin = new Thickness(10, 4, 0, 0); ConditionTypeControl condition = new ConditionTypeControl(); condition.Type = move.MoveData.ConditionType; condition.Margin = new Thickness(10, 4, 0, 0); condition.Visibility = Visibility.Hidden; Label name = new Label(); name.Content = move.MoveData.Name; name.Margin = new Thickness(120, 0, 0, 0); name.FontWeight = FontWeights.Bold; Label pp = new Label(); pp.Content = (move.MoveData.PP == 0 ? "--" : move.TotalPP.ToString()); pp.Margin = new Thickness(281, 0, 0, 0); pp.FontWeight = FontWeights.Bold; grid.Children.Add(panel); grid.Children.Add(type); grid.Children.Add(condition); grid.Children.Add(name); grid.Children.Add(pp); listViewItem.Content = grid; listViewItem.Tag = move; listViewMoves.Items.Add(listViewItem); } this.labelMoveAccuracy.Content = ""; this.labelMovePower.Content = ""; this.labelMoveCategory.Content = ""; this.labelMoveAppeal.Content = ""; this.labelMoveJam.Content = ""; this.textBlockMoveDescription.Text = ""; buttonOpenMoveInBulbapedia.Visibility = Visibility.Hidden; }
public int IndexOf(IPokemon pokemon) { for (int i = 0; i < party.Count; i++) { if (party[i] == pokemon) { return(i); } } return(-1); }
public bool TryToUseItemOnPokemon(IPokemon targetPokemon) { bool pokemonIsEligibleToReceiveItem = ItemValidator.CanUsePotionOnPokemon(targetPokemon); if (pokemonIsEligibleToReceiveItem) { targetPokemon.CurrentHealthPoints += GetPositiveDifferenceInHealthPoints(targetPokemon); } return(pokemonIsEligibleToReceiveItem); }
private long[] GetPokemonEVs(IPokemon pokemon) { long[] list = new long[6]; list[0] = pokemon.HPEV; list[1] = pokemon.AttackEV; list[2] = pokemon.DefenseEV; list[3] = pokemon.SpAttackEV; list[4] = pokemon.SpDefenseEV; list[5] = pokemon.SpeedEV; return(list); }
private long[] GetPokemonStats(IPokemon pokemon) { long[] list = new long[6]; list[0] = pokemon.HP; list[1] = pokemon.Attack; list[2] = pokemon.Defense; list[3] = pokemon.SpAttack; list[4] = pokemon.SpDefense; list[5] = pokemon.Speed; return(list); }
private bool PokemonHasMove(IPokemon pokemon, ushort move) { for (int i = 0; i < pokemon.NumMoves; i++) { if (pokemon.GetMoveIDAt(i) == move) { return(true); } } return(false); }
public object Clone() { IPokemon pokemon = PokemonFactory.CreatePokemon(); foreach (PropertyInfo property in pokemon.GetType().GetProperties()) { property.SetValue(pokemon, property.GetValue(this, null), null); } pokemon.ResetStats(); return(pokemon); }
public void Remove(IPokemon pokemon) { if (pokemon == depositedPokemon) { pokePC.GameSave.IsChanged = true; depositedPokemon = null; DaycareStatus = 0; InitialLevel = 0; InitialPurification = 0; } }
public static void TrainerDrawsbackPokemon(IPokemon pokemon, bool isEnemyTrainer = false) { if (isEnemyTrainer) { EnemyAction.EnemyTrainerDrawsbackPokemon(pokemon); } else { PlayerAction.PlayerDrawsbackPokemon(pokemon); } }
public void ItemShouldNotHealPokemonMoreThanItsHealthPointsProperty(int damageTaken) { IPokemon onix = PokemonFactory.CreatePokemon <Onix>(); onix.CurrentHealthPoints -= damageTaken; _player?.Items .ElementAt(POTION_INDEX_IN_TRAINER_INVENTORY).Value[POTION_INDEX_IN_TRAINER_INVENTORY] .TryToUseItemOnPokemon(onix); Assert.True(onix.CurrentHealthPoints == onix.TotalHealthPoints); }
public IPokemon GetNextAvailablePokemon() { IPokemon firstAvailablePokemon = PokemonTeam.FirstOrDefault(pkmn => !pkmn.Fainted)?.Pokemon; if (firstAvailablePokemon != null) { SetPokemonAsCurrent(firstAvailablePokemon); } return(firstAvailablePokemon); }
public int IndexOf(IPokemon pokemon) { for (int i = 0; i < 30; i++) { if (pokemonStorage[i] == pokemon) { return(i); } } return(-1); }
public void ItemShouldHealPokemon(int damageTaken) { IPokemon onix = PokemonFactory.CreatePokemon <Onix>(); onix.CurrentHealthPoints -= damageTaken; bool pokemonIsEligibleForPotionUse = (bool)_player?.Items .ElementAt(POTION_INDEX_IN_TRAINER_INVENTORY).Value[POTION_INDEX_IN_TRAINER_INVENTORY] .TryToUseItemOnPokemon(onix); Assert.True(pokemonIsEligibleForPotionUse); }
public void Remove(IPokemon pokemon) { for (int i = 0; i < 30; i++) { if (pokemonStorage[i] == pokemon) { pokePC.GameSave.IsChanged = true; pokemonStorage[i] = null; break; } } }
public void PopulateRandomCPU() { Name = "Breeder Bob"; DamagingMove move1 = new DamagingMove("Thunderbolt", Type.Electric, MoveType.Special, 100, 15, 90); Species Pichu = new Species("Pichu", Type.Electric, Type.None, 20, 40, 15, 35, 35, 60, true); Species Pikachu = new Species("Pikachu", Type.Electric, Type.None, 35, 55, 40, 50, 50, 90, true); Species Raichu = new Species("Raichu", Type.Electric, Type.Psychic, 60, 85, 50, 95, 85, 110, false); Pokemon3 = new Pokemon(Pichu, 50, Nature.Timid, 31, 0, 31, 31, 31, 31, 4, 0, 0, 252, 0, 252, Item.Eviolite, move1, null, null, null); Pokemon2 = new Pokemon(Pikachu, 50, Nature.Timid, 31, 0, 31, 31, 31, 31, 4, 0, 0, 252, 0, 252, Item.ChoiceScarf, move1, null, null, null); Pokemon1 = new Pokemon(Raichu, 50, Nature.Timid, 31, 0, 31, 31, 31, 31, 4, 0, 0, 252, 0, 252, Item.ChoiceBand, move1, null, null, null); }
public static StatusMove[] ProcessStatusMove(IPokemon attackingPokemon, IPokemon targetPokemon, IMove move) { IPokemon pokemonToChangeStatus = move.MoveTarget == StatusMoveTarget.SELF ? attackingPokemon : targetPokemon; for (int i = 0; i < move.StatusMoves.Count; i++) { switch (move.StatusMoves[i]) { case StatusMove.ATTACK_UP: pokemonToChangeStatus.AttackPoints += POINTS_MODIFIER; break; case StatusMove.ATTACK_DOWN: pokemonToChangeStatus.AttackPoints -= POINTS_MODIFIER; break; case StatusMove.DEFENSE_UP: pokemonToChangeStatus.DefensePoints += POINTS_MODIFIER; break; case StatusMove.DEFENSE_DOWN: pokemonToChangeStatus.DefensePoints -= POINTS_MODIFIER; break; case StatusMove.SPECIALATTACK_UP: pokemonToChangeStatus.SpecialAttackPoints += POINTS_MODIFIER; break; case StatusMove.SPECIALATTACK_DOWN: pokemonToChangeStatus.SpecialAttackPoints -= POINTS_MODIFIER; break; case StatusMove.SPECIALDEFENSE_UP: pokemonToChangeStatus.SpecialDefensePoints += POINTS_MODIFIER; break; case StatusMove.SPECIALDEFENSE_DOWN: pokemonToChangeStatus.SpecialDefensePoints -= POINTS_MODIFIER; break; case StatusMove.SPEED_UP: pokemonToChangeStatus.SpeedPoints += POINTS_MODIFIER; break; case StatusMove.SPEED_DOWN: pokemonToChangeStatus.SpeedPoints -= POINTS_MODIFIER; break; } } return(move.StatusMoves.ToArray()); }
public PokemonDialog(ConversationState conversationState, IPokemon pokemon) : base(nameof(PokemonDialog)) { _pokemon = pokemon; AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { IntroStepAsync, PokemonStepAsync, })); AddDialog(new TextPrompt(nameof(_pokemonValidator), PokemonValidatorAsync)); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
static public void Battle(IPokemon pkmn1, IPokemon pkmn2, double random1, double random2) { Console.WriteLine(pkmn1.Name + " attacks " + pkmn2.Name); pkmn2.TakeDamage(pkmn1.DoDamage(80, false, random1, 1), false); Console.WriteLine(); if (pkmn2.RemainingHP > 0) { Console.WriteLine(pkmn2.Name + " attacks " + pkmn1.Name); pkmn1.TakeDamage(pkmn2.DoDamage(80, true, random2, 1), true); Console.WriteLine(); } }
static void Main(string[] args) { IPokemon myPokemon = ChoicePokemon(); IPokemonFoe foe = ChoiceFoe.ChoicePokemonFoe(myPokemon); myPokemon.SetFoe(foe); myPokemon.Go(); myPokemon.ChoiceAttack(); Console.ReadLine(); }
public static void ProcessStatusAttack(IPokemon attackingPokemon, IPokemon targetPokemon, IMove move) { StatusMove[] pokemonAlteredStatuses = StatusMoveManager.ProcessStatusMove(attackingPokemon, targetPokemon, move); if (move.MoveTarget.Value == StatusMoveTarget.SELF) { ConsoleBattleInfoStatuses.ShowInflictedStatuses(attackingPokemon, pokemonAlteredStatuses); } else { ConsoleBattleInfoStatuses.ShowInflictedStatuses(targetPokemon, pokemonAlteredStatuses); } }
public void Remove(IPokemon pokemon) { if (pokemon == shadowPokemon) { pokePC.GameSave.IsChanged = true; shadowPokemon = null; } if (normalPokemon.Contains(pokemon)) { pokePC.GameSave.IsChanged = true; normalPokemon.Remove((XDPokemon)pokemon); } }
private void PerformAttack(IPokemon pokemon, IAttack attack, IPokemon target) { if (pokemon.IsAbleToAttackAfterConditionEffect()) { if (pokemon.IsAbleToAttack()) { _battleLogController.SetText($"{pokemon.Name} used {attack.Name}"); ExecuteAttack(pokemon, attack, target); ExecuteAfterAttackAdditionalEffects(pokemon, attack, target); ExecuteChangeStatsAfterAttack(pokemon, attack, target); } } }
public static IPokemonFoe ChoicePokemonFoe(IPokemon me) { List <IPokemonFoe> foes = new List <IPokemonFoe>(); foes.Add(new Pidgey(me)); foes.Add(new Pidgey(me)); foes.Add(new Pidgey(me)); Random rnd = new Random(); var foeId = rnd.Next(0, foes.Count - 1); return(foes[foeId]); }
public ChangeDeoxysFormWindow(IPokemon deoxys) { InitializeComponent(); this.form = deoxys.DeoxysForm; this.deoxys = deoxys; AddDeoxysItem(byte.MaxValue, "Game Specific"); AddDeoxysItem(0, "Normal Form"); AddDeoxysItem(1, "Attack Form"); AddDeoxysItem(2, "Defense Form"); AddDeoxysItem(3, "Speed Form"); comboBoxForm.SelectedIndex = (form == byte.MaxValue ? 0 : form + 1); }
public void PokemonStatModifierStages_CannotGoBelowMinusSix(int level, int id, int changeValueBy, int expectedResult) { IPokemon pokemon = PokemonFactory.CreatePokemon(level, id); for (int i = 0; i < pokemon.StatModifierStages.Length; i++) { //StatsChanger.ChangeTempPokemonStats(pokemon, i, changeValueBy); } for (int i = 0; i < pokemon.StatModifierStages.Length; i++) { Assert.AreEqual(expectedResult, pokemon.StatModifierStages[i]); } }
public int KeepPlayerChoosingMove(int movesLimit) { int chosenMove = -1; IPokemon currentPokemon = Player.GetCurrentPokemon(); while (chosenMove <= -1 || chosenMove > movesLimit) { ConsoleBattleInfo.WriteAllAvailableAttacksOnConsole(currentPokemon); chosenMove = ConsoleUtils.GetPlayerChosenIndex(Console.ReadLine()); } return(chosenMove); }
public void Remove(IPokemon pokemon) { int index = IndexOf(pokemon); if (index == 0 || index == 1) { // Prevent the user from breeding Groudons with Ditto or freezing the game. ((GBAGameSave)PokePC.GameSave).ClearDaycareEgg(); } if (index != -1) { this[index] = null; } }
public void Remove(IPokemon pokemon) { for (int i = 0; i < 30; i++) { if (pokemonList[i] == pokemon) { if (pokePC != null) { pokePC.GameSave.IsChanged = true; } pokemonList[i] = null; } } }
public void Receive(SwapPokemon swapPokemonAction) { IPokemon swappedPokemon = swapPokemonAction.Slot.Pokemon; SwapPokemonEventArgs swapPokemonEventArgs = new SwapPokemonEventArgs(this, swapPokemonAction); OnSwapPokemon?.Invoke(this, swapPokemonEventArgs); // TODO PokemonSwappedEventArgs pokemonSwappedEventArgs = new PokemonSwappedEventArgs(this, swapPokemonAction, swappedPokemon); OnPokemonSwapped?.Invoke(this, pokemonSwappedEventArgs); }
public void SetPokemonAsCurrent(IPokemon pokemon) { Parallel.ForEach(PokemonTeam, pkmn => { if (pkmn.Current) { pkmn.Current = false; } if (pkmn.Pokemon.GetType().Name == pokemon.GetType().Name) { pkmn.Current = true; } }); }
public int IndexOf(IPokemon pokemon) { if (pokemon == shadowPokemon) { return(0); } for (int i = 0; i < normalPokemon.Count; i++) { if (pokemon == normalPokemon[i]) { return(i + 1); } } return(-1); }
/// <summary> /// PokemonSerializable contructor /// </summary> /// <param name="pokemon"> The IPokemon element to be converted </param> public PokemonSerializable(IPokemon pokemon) { if (pokemon == null) throw new ArgumentNullException("pokemon"); Name = pokemon.Name; Number = pokemon.Number; HealthPoints = pokemon.HealthPoints; IndividualValues = pokemon.IndividualValues; Attack = pokemon.Attack; Defense = pokemon.Defense; PrimaryTypeSerializable = (PokemonType)pokemon.PrimaryType; SecondaryTypeSerializable = (PokemonType)pokemon.SecondaryType; SpecialAttack = pokemon.SpecialAttack; SpecialDefense = pokemon.SpecialDefense; Speed = pokemon.Speed; }
public void Reload() { comboBoxGame.ReloadGameSaves(); if (pokePC != null) { if (boxIndex >= pokePC.NumBoxes) { int mod = (boxIndex % (int)pokePC.NumBoxes); boxIndex = (mod < 0 ? (mod + (int)pokePC.NumBoxes) : mod); } UpdateSlaves(ActualWidth); pokeBoxControlMaster.LoadBox(GetWrappedBox(boxIndex + BoxOffset), gameIndex); for (int i = 0; i < slaves.Count; i++) slaves[i].LoadBox(GetWrappedBox(boxIndex + i + 1 + BoxOffset), gameIndex); if (containerMode == ContainerTypes.Party) pokeBoxControlParty.LoadBox(pokePC.Party, gameIndex); else if (containerMode == ContainerTypes.Daycare) pokeBoxControlParty.LoadBox(pokePC.Daycare, gameIndex); else if (containerMode == ContainerTypes.Purifier) pokeBoxControlParty.LoadBox(((XDPokePC)pokePC).GetChamber(0), gameIndex); gotoPokemon = null; pokeBoxControlMaster.UnhighlightPokemon(); } }
public void LoadUI(int newGameIndex = -2, int newRowIndex = -1) { if (gameIndex != -2 || rowIndex != -1) { loaded = false; if (newGameIndex != -2) this.gameIndex = newGameIndex; if (newRowIndex != -1) this.rowIndex = newRowIndex; this.comboBoxGame.SelectedGameIndex = this.gameIndex; this.comboBoxRows.SelectedIndex = this.rowIndex; loaded = true; gotoPokemon = null; pokeBoxControlMaster.UnhighlightPokemon(); } if (GameSave is ManagerGameSave) { this.pokePC = (GameSave as ManagerGameSave).GetPokePCRow(rowIndex); comboBoxRows.Visibility = Visibility.Visible; buttonParty.Visibility = Visibility.Hidden; } else { this.pokePC = GameSave.PokePC; comboBoxRows.Visibility = Visibility.Hidden; buttonParty.Visibility = Visibility.Visible; } if (pokePC == null) { this.pokeBoxControlMaster.UnloadBox(); foreach (PokeBoxControl slave in slaves) slave.UnloadBox(); return; } this.boxIndex = pokePC.CurrentBox; this.pokeBoxControlMaster.PokemonViewer = pokemonViewer; this.pokeBoxControlParty.PokemonViewer = pokemonViewer; if (this.pokePC.Party == null) { containerMode = ContainerTypes.Box; buttonParty.Content = "Show Party"; buttonParty.IsEnabled = false; pokeBoxControlParty.Visibility = Visibility.Hidden; } else { buttonParty.IsEnabled = true; if (containerMode == ContainerTypes.Purifier && pokePC.GameType != GameTypes.XD) { containerMode = ContainerTypes.Box; buttonParty.Content = "Show Party"; pokeBoxControlParty.Visibility = Visibility.Hidden; } else if (containerMode == ContainerTypes.Daycare && pokePC.GameType == GameTypes.XD) { buttonParty.Content = "Show Purifier"; } } RefreshUI(); }
public void GotoPokemon(IPokemon pokemon) { if (pokemon.PokeContainer == null || pokemon.ContainerIndex == -1) { gotoPokemon = null; return; } if (pokemon.PokeContainer.Type == ContainerTypes.Party) { if (containerMode != ContainerTypes.Party) { containerMode = ContainerTypes.Party; buttonParty.Content = (pokePC.Daycare != null ? "Show Daycare" : "Hide Party"); pokeBoxControlParty.Visibility = Visibility.Visible; pokeBoxControlParty.LoadBox(pokePC.Party, gameIndex); } pokeBoxControlParty.HighlightPokemon(pokemon); } else if (pokemon.PokeContainer.Type == ContainerTypes.Daycare) { if (containerMode != ContainerTypes.Daycare) { containerMode = ContainerTypes.Daycare; buttonParty.Content = (pokePC.GameType == GameTypes.XD ? "Show Purifier" : "Hide Daycare"); pokeBoxControlParty.Visibility = Visibility.Visible; pokeBoxControlParty.LoadBox(pokePC.Daycare, gameIndex); } pokeBoxControlParty.HighlightPokemon(pokemon); } else if (pokemon.PokeContainer.Type == ContainerTypes.Purifier) { containerMode = ContainerTypes.Purifier; buttonParty.Content = "Hide Purifier"; pokeBoxControlParty.ChamberIndex = ((XDPurificationChamber)pokemon.PokeContainer).ChamberNumber; pokeBoxControlParty.Visibility = Visibility.Visible; pokeBoxControlParty.LoadBox(((XDPokePC)pokePC).GetChamber(pokeBoxControlParty.ChamberIndex), gameIndex); pokeBoxControlParty.HighlightPokemon(pokemon); } else { containerMode = ContainerTypes.Box; buttonParty.Content = "Show Party"; pokeBoxControlParty.Visibility = Visibility.Hidden; boxIndex = (int)(pokemon.PokeContainer as IPokeBox).BoxNumber; pokePC.CurrentBox = boxIndex; pokeBoxControlMaster.LoadBox(GetWrappedBox(boxIndex + BoxOffset), gameIndex); for (int i = 0; i < slaves.Count; i++) slaves[i].LoadBox(GetWrappedBox(boxIndex + i + 1 + BoxOffset), gameIndex); if (BoxOffset == 0) pokeBoxControlMaster.HighlightPokemon(pokemon); else slaves[-BoxOffset - 1].HighlightPokemon(pokemon); } gotoPokemon = pokemon; }
public void AddPokemon(IPokemon pokemon) { pokePC.GameSave.IsChanged = true; IPokemon pkm = (pokemon != null ? (pokemon is ColosseumPokemon ? pokemon : pokemon.CreateColosseumPokemon(((GCGameSave)GameSave).CurrentRegion)): null); if (pkm != null) { pkm.PokeContainer = this; if (pokePC.GameSave != null) ((GCGameSave)pokePC.GameSave).RegisterPokemon(pkm); party.Add(pkm); } }
public void RegisterPokemon(IPokemon pokemon) { MostRecentSave.StrategyMemoData.RegisterPokemon(pokemon); }
public static bool? ShowDialog(Window owner, IPokemon pokemon) { RearangeMovesWindow window = new RearangeMovesWindow(pokemon); window.Owner = owner; return window.ShowDialog(); }
public static EvolutionData[] GetEvolutionsOnItem(IPokemon pokemon) { PokemonData pokemonData = pokemon.PokemonData; if (pokemonData.HasEvolutions) { List<EvolutionData> returnEvolutions = new List<EvolutionData>(); for (int i = 0; i < pokemonData.NumEvolutions; i++) { EvolutionData evolution = pokemonData.GetEvolution(i); if (evolution.EvolutionType == EvolutionTypes.Item) { returnEvolutions.Add(evolution); } if (evolution.EvolutionType == EvolutionTypes.Trade && evolution.HasParameters) { returnEvolutions.Add(evolution); } } return returnEvolutions.ToArray(); } return new EvolutionData[0]; }
public void OwnPokemon(IPokemon pokemon) { if (!pokemon.IsEgg) RegisterPokemon(pokemon); }
public void AddPokemon(IPokemon pokemon) { pokePC.GameSave.IsChanged = true; IPokemon pkm = (pokemon != null ? (pokemon is XDPokemon ? pokemon : pokemon.CreateXDPokemon(((GCGameSave)GameSave).CurrentRegion)): null); pkm.GameType = GameType; pkm.PokeContainer = this; if (pokePC.GameSave != null) pokePC.GameSave.OwnPokemon(pkm); depositedPokemon = pkm as XDPokemon; depositedPokemon = pkm as XDPokemon; DaycareStatus = 1; InitialLevel = 0; InitialPurification = 0; }
public static EvolutionData GetEvolutionFromItemID(IPokemon pokemon, ushort itemID) { PokemonData pokemonData = pokemon.PokemonData; if (pokemonData.HasEvolutions) { List<ushort> returnItems = new List<ushort>(); for (int i = 0; i < pokemonData.NumEvolutions; i++) { EvolutionData evolution = pokemonData.GetEvolution(i); if (evolution.EvolutionType == EvolutionTypes.Item && (ushort)evolution.Parameters[0] == itemID) { return evolution; } if (evolution.EvolutionType == EvolutionTypes.Trade && evolution.HasParameters && (ushort)evolution.Parameters[0] == itemID) { return evolution; } } } return null; }
public void Remove(IPokemon pokemon) { if (party.Contains(pokemon)) { pokePC.GameSave.IsChanged = true; party.Remove(pokemon); } }
public int IndexOf(IPokemon pokemon) { for (int i = 0; i < party.Count; i++) { if (party[i] == pokemon) return i; } return -1; }
private void OnPokemonSelected(object sender, PokemonSelectedEventArgs e) { gotoPokemon = null; }
private void OnPreviousBoxButtonClicked(object sender, RoutedEventArgs e) { if (pokePC == null) return; pokePC.CurrentBox = boxIndex - 1; boxIndex = pokePC.CurrentBox; pokeBoxControlMaster.LoadBox(GetWrappedBox(boxIndex + BoxOffset), gameIndex); for (int i = 0; i < slaves.Count; i++) slaves[i].LoadBox(GetWrappedBox(boxIndex + i + 1 + BoxOffset), gameIndex); if (containerMode == ContainerTypes.Party) pokeBoxControlParty.LoadBox(pokePC.Party, gameIndex); else if (containerMode == ContainerTypes.Daycare) pokeBoxControlParty.LoadBox(pokePC.Daycare, gameIndex); else if (containerMode == ContainerTypes.Purifier) pokeBoxControlParty.LoadBox(((XDPokePC)pokePC).GetChamber(0), gameIndex); gotoPokemon = null; pokeBoxControlMaster.UnhighlightPokemon(); }
public static ushort[] GetMovesLearnedAtLevelRange(IPokemon pokemon, byte startLevel, byte endLevel) { List<ushort> moves = new List<ushort>(); if (pokemon.DexID == 386) { for (int i = 0; i < pokemon.PokemonData.GetForm(pokemon.FormID).NumLearnableMoves; i++) { LearnableMove move = pokemon.PokemonData.GetForm(pokemon.FormID).GetLearnableMove(i); if (move.LearnType == LearnableMoveTypes.Level && move.Level >= startLevel && move.Level <= endLevel && !PokemonHasMove(pokemon, move.MoveID)) { if (!moves.Contains(move.MoveID)) moves.Add(move.MoveID); } } } else { for (int i = 0; i < pokemon.PokemonData.NumLearnableMoves; i++) { LearnableMove move = pokemon.PokemonData.GetLearnableMove(i); if (move.LearnType == LearnableMoveTypes.Level && move.Level >= startLevel && move.Level <= endLevel && !PokemonHasMove(pokemon, move.MoveID)) { if (!moves.Contains(move.MoveID)) moves.Add(move.MoveID); } } } return moves.ToArray(); }
public static ushort[] GetTeachableMachineMoves(IPokemon pokemon) { List<ushort> moves = new List<ushort>(); if (pokemon.DexID == 386) { for (int i = 0; i < pokemon.PokemonData.GetForm(pokemon.FormID).NumLearnableMoves; i++) { LearnableMove move = pokemon.PokemonData.GetForm(pokemon.FormID).GetLearnableMove(i); if (move.LearnType == LearnableMoveTypes.Machine && !PokemonHasMove(pokemon, move.MoveID)) { moves.Add(move.MoveID); } } } else { for (int i = 0; i < pokemon.PokemonData.NumLearnableMoves; i++) { LearnableMove move = pokemon.PokemonData.GetLearnableMove(i); if (move.LearnType == LearnableMoveTypes.Machine && !PokemonHasMove(pokemon, move.MoveID)) { moves.Add(move.MoveID); } } } return moves.ToArray(); }
public static bool IsPokemonWithRoamingIVGlitch(IPokemon pokemon) { if (pokemon.DexID == 243 || pokemon.DexID == 244 || pokemon.DexID == 245 || pokemon.DexID == 380 || pokemon.DexID == 381) { return (pokemon.AttackIV <= 7 && pokemon.DefenseIV == 0 && pokemon.SpAttackIV == 0 && pokemon.SpDefenseIV == 0 && pokemon.SpeedIV == 0) ; } return false; }
public RearangeMovesWindow(IPokemon pokemon) { InitializeComponent(); this.pokemon = pokemon; ContextMenu contextMenu = new ContextMenu(); MenuItem delete = new MenuItem(); delete.Header = "Delete Move"; delete.Click += OnDeleteMove; delete.IsEnabled = pokemon.NumMoves > 1; contextMenu.Items.Add(delete); moves = new ObservableCollection<ListViewItem>(); for (int i = 0; i < pokemon.NumMoves; i++) { Move move = pokemon.GetMoveAt(i); ListViewItem listViewItem = new ListViewItem(); Grid grid = new Grid(); grid.Width = 321; grid.Height = 27; Rectangle panel = new Rectangle(); panel.Margin = new Thickness(1, 1, 0, 0); panel.Width = 319; panel.Height = 23; panel.RadiusX = 2; panel.RadiusY = 2; panel.Fill = new SolidColorBrush(Color.FromRgb(248, 248, 248)); panel.Stroke = new SolidColorBrush(Color.FromRgb(0, 0, 0)); panel.StrokeThickness = 1; PokemonTypeControl type = new PokemonTypeControl(); type.Type = move.MoveData.Type; type.Margin = new Thickness(10, 4, 0, 0); ConditionTypeControl condition = new ConditionTypeControl(); condition.Type = move.MoveData.ConditionType; condition.Margin = new Thickness(10, 4, 0, 0); condition.Visibility = Visibility.Hidden; Label name = new Label(); name.Content = move.MoveData.Name; name.Margin = new Thickness(120, 0, 0, 0); name.FontWeight = FontWeights.Bold; Label pp = new Label(); pp.Content = (move.MoveData.PP == 0 ? "--" : move.TotalPP.ToString()); pp.Margin = new Thickness(281, 0, 0, 0); pp.FontWeight = FontWeights.Bold; grid.Children.Add(panel); grid.Children.Add(type); grid.Children.Add(condition); grid.Children.Add(name); grid.Children.Add(pp); listViewItem.Content = grid; listViewItem.Tag = move; moves.Add(listViewItem); listViewItem.ContextMenu = contextMenu; } listViewMoves.ItemsSource = moves; dropManager = new ListViewDragDropManager<ListViewItem>(listViewMoves); this.labelMoveAccuracy.Content = ""; this.labelMovePower.Content = ""; this.labelMoveCategory.Content = ""; this.labelMoveAppeal.Content = ""; this.labelMoveJam.Content = ""; this.textBlockMoveDescription.Text = ""; buttonOpenMoveInBulbapedia.Visibility = Visibility.Hidden; }
public static bool PokemonHasMove(IPokemon pokemon, ushort moveID) { for (int i = 0; i < pokemon.NumMoves; i++) { if (pokemon.GetMoveIDAt(i) == moveID) return true; } return false; }
public static ushort[] GetEvolutionItemIDs(IPokemon pokemon) { PokemonData pokemonData = pokemon.PokemonData; if (pokemonData.HasEvolutions) { List<ushort> returnItems = new List<ushort>(); for (int i = 0; i < pokemonData.NumEvolutions; i++) { EvolutionData evolution = pokemonData.GetEvolution(i); if (evolution.EvolutionType == EvolutionTypes.Item) { returnItems.Add((ushort)evolution.Parameters[0]); } if (evolution.EvolutionType == EvolutionTypes.Trade && evolution.HasParameters) { returnItems.Add((ushort)evolution.Parameters[0]); } } return returnItems.ToArray(); } return new ushort[0]; }
public void PlacePokemonInNextAvailableSlot(int boxStart, int indexStart, IPokemon pokemon) { // Check the first box at the index offset if (indexStart > 0) { for (int j = indexStart; j < boxes[boxStart].NumSlots; j++) { if (boxes[boxStart][j] == null) { boxes[boxStart][j] = pokemon; return; } } boxStart++; } // Check the rest of the boxes for (int i = 0; i < boxes.Length; i++) { int boxIndex = (i + boxStart) % boxes.Length; for (int j = 0; j < boxes[boxIndex].NumSlots; j++) { if (boxes[boxIndex][j] == null) { boxes[boxIndex][j] = pokemon; return; } } } }
public int IndexOf(IPokemon pokemon) { if (pokemon == depositedPokemon) return 0; return -1; }
public static EvolutionData GetEvolutionNow(IPokemon pokemon) { PokemonData pokemonData = pokemon.PokemonData; if (pokemonData.HasEvolutions) { List<EvolutionData> returnEvolutions = new List<EvolutionData>(); for (int i = 0; i < pokemonData.NumEvolutions; i++) { EvolutionData evolution = pokemonData.GetEvolution(i); if (evolution.EvolutionType == EvolutionTypes.Trade && !evolution.HasParameters) { return evolution; } } } return null; }
public static EvolutionData GetEvolutionOnLevelUp(IPokemon pokemon) { PokemonData pokemonData = pokemon.PokemonData; if (pokemonData.HasEvolutions) { for (int i = 0; i < pokemonData.NumEvolutions; i++) { EvolutionData evolution = pokemonData.GetEvolution(i); if (evolution.EvolutionType == EvolutionTypes.Level && pokemon.Level >= evolution.Parameters[0]) { return evolution; } if (evolution.EvolutionType == EvolutionTypes.Friendship && pokemon.Friendship >= 220) { if (evolution.HasParameters) { if ((EvolutionParameters)evolution.Parameters[0] == EvolutionParameters.Day && !PokeManager.IsNight) return evolution; else if ((EvolutionParameters)evolution.Parameters[0] == EvolutionParameters.Night && PokeManager.IsNight) return evolution; } else return evolution; } if (evolution.EvolutionType == EvolutionTypes.Stat && pokemon.Level >= evolution.Parameters[1]) { if ((EvolutionParameters)evolution.Parameters[0] == EvolutionParameters.AttackOverDefense && pokemon.Attack > pokemon.Defense) return evolution; else if ((EvolutionParameters)evolution.Parameters[0] == EvolutionParameters.DefenseOverAttack && pokemon.Defense > pokemon.Attack) return evolution; else if ((EvolutionParameters)evolution.Parameters[0] == EvolutionParameters.AttackAndDefense && pokemon.Attack == pokemon.Defense) return evolution; } if (evolution.EvolutionType == EvolutionTypes.Condition && pokemon.Beauty >= 170) { return evolution; } if (evolution.EvolutionType == EvolutionTypes.Personality) { if ((EvolutionParameters)evolution.Parameters[0] == EvolutionParameters.LessFive && !pokemon.WurpleIsCascoon) return evolution; else if ((EvolutionParameters)evolution.Parameters[0] == EvolutionParameters.GreaterEqualFive && pokemon.WurpleIsCascoon) return evolution; } if (evolution.EvolutionType == EvolutionTypes.NinjaskShedinja && pokemon.Level >= evolution.Parameters[0]) { return evolution; } } } return null; }
public void HighlightPokemon(IPokemon pokemon) { int index = pokemon.PokeContainer.IndexOf(pokemon); if (IsViewingDaycare) { Rectangle selector = daycareClickAreas[index]; imageDaycareHighlighter.Margin = new Thickness(31 + (index % 3) * 32, 51 + (index / 3) * 25, 0, 0); imageDaycareHighlighter.Visibility = Visibility.Visible; this.imageBoxHighlighter.Visibility = Visibility.Hidden; this.imagePartyHighlighter.Visibility = Visibility.Hidden; this.imagePurifierHighlighter.Visibility = Visibility.Hidden; } else if (IsViewingParty) { Rectangle selector = partyClickAreas[index]; imagePartyHighlighter.Margin = new Thickness(31 + (index % 3) * 32, 51 + (index / 3) * 25, 0, 0); imagePartyHighlighter.Visibility = Visibility.Visible; this.imageBoxHighlighter.Visibility = Visibility.Hidden; this.imageDaycareHighlighter.Visibility = Visibility.Hidden; this.imagePurifierHighlighter.Visibility = Visibility.Hidden; } else if (IsViewingPurifier) { Rectangle selector = partyClickAreas[index]; imagePurifierHighlighter.Margin = new Thickness(31 + PurifierSlotOffsets[index].X * 32, 32 + PurifierSlotOffsets[index].Y * 25, 0, 0); imagePurifierHighlighter.Visibility = Visibility.Visible; this.imageBoxHighlighter.Visibility = Visibility.Hidden; this.imageDaycareHighlighter.Visibility = Visibility.Hidden; this.imagePartyHighlighter.Visibility = Visibility.Hidden; } else if (IsViewingBox) { Rectangle selector = boxClickAreas[index]; imageBoxHighlighter.Margin = new Thickness(1 + (index % 6) * 24, 5 + (index / 6) * 24, 0, 0); imageBoxHighlighter.Visibility = Visibility.Visible; this.imagePartyHighlighter.Visibility = Visibility.Hidden; this.imageDaycareHighlighter.Visibility = Visibility.Hidden; this.imagePurifierHighlighter.Visibility = Visibility.Hidden; } pokemonViewer.LoadPokemon(pokemon); }