public void calculateStats() { int[] baseStats = PokemonDatabase.getPokemon(pokemonID).getBaseStats(); if (baseStats[0] == 1) { this.HP = 1; } else { int prevMaxHP = this.HP; this.HP = Mathf.FloorToInt(((IV_HP + (2 * baseStats[0]) + (EV_HP / 4) + 100) * level) / 100 + 10); this.currentHP = (this.currentHP + (this.HP - prevMaxHP) < this.HP) ? this.currentHP + (this.HP - prevMaxHP) : this.HP; } if (baseStats[1] == 1) { this.ATK = 1; } else { this.ATK = Mathf.FloorToInt(Mathf.FloorToInt(((IV_ATK + (2 * baseStats[1]) + (EV_ATK / 4)) * level) / 100 + 5) * NatureDatabase.getNature(nature).getATK()); } if (baseStats[2] == 1) { this.DEF = 1; } else { this.DEF = Mathf.FloorToInt(Mathf.FloorToInt(((IV_DEF + (2 * baseStats[2]) + (EV_DEF / 4)) * level) / 100 + 5) * NatureDatabase.getNature(nature).getDEF()); } if (baseStats[3] == 1) { this.SPA = 1; } else { this.SPA = Mathf.FloorToInt(Mathf.FloorToInt(((IV_SPA + (2 * baseStats[3]) + (EV_SPA / 4)) * level) / 100 + 5) * NatureDatabase.getNature(nature).getSPA()); } if (baseStats[4] == 1) { this.SPD = 1; } else { this.SPD = Mathf.FloorToInt(Mathf.FloorToInt(((IV_SPD + (2 * baseStats[4]) + (EV_SPD / 4)) * level) / 100 + 5) * NatureDatabase.getNature(nature).getSPD()); } if (baseStats[5] == 1) { this.SPE = 1; } else { this.SPE = Mathf.FloorToInt(Mathf.FloorToInt(((IV_SPE + (2 * baseStats[5]) + (EV_SPE / 4)) * level) / 100 + 5) * NatureDatabase.getNature(nature).getSPE()); } }
public EvolutionWindow(IPokemon pokemon, ushort evolutionDexID) { InitializeComponent(); this.pokemon = pokemon; this.evolutionDexID = evolutionDexID; this.evolved = false; this.evolutionState = 0; this.timer = new DispatcherTimer(); this.timer.Tick += OnTick; this.timer.Interval = TimeSpan.FromSeconds(1.5); this.timer.Start(); this.storyboard = new Storyboard(); this.storyboard.Completed += OnStoryboardCompleted; this.imagePrevolution.Source = PokemonDatabase.GetPokemonImageFromDexID(pokemon.DexID, pokemon.IsShiny); this.imageEvolution.Source = PokemonDatabase.GetPokemonImageFromDexID(evolutionDexID, pokemon.IsShiny); this.rectMaskPrevolution.OpacityMask = new ImageBrush(PokemonDatabase.GetPokemonImageFromDexID(pokemon.DexID, pokemon.IsShiny)); this.rectMaskEvolution.OpacityMask = new ImageBrush(PokemonDatabase.GetPokemonImageFromDexID(evolutionDexID, pokemon.IsShiny)); this.rectMaskPrevolution.Opacity = 0; this.textBlockMessage.Text = "What?\nYour " + pokemon.Nickname + " is evolving!"; playerCry = new MediaPlayer(); playerCry.MediaEnded += OnMediaEnded; playerCry.Volume = PokeManager.Settings.MutedVolume; playerEvolutionCry = new MediaPlayer(); playerEvolutionCry.MediaEnded += OnMediaEnded; playerEvolutionCry.Volume = PokeManager.Settings.MutedVolume; playerMusic = new MediaPlayer(); playerMusic.MediaEnded += OnMediaEnded; playerMusic.Volume = PokeManager.Settings.MutedVolume; if (PokeManager.Settings.IsMuted) { imageVolume.Source = ResourceDatabase.GetImageFromName("IconVolumeMute"); } else { imageVolume.Source = ResourceDatabase.GetImageFromName("IconVolumeOn"); } CreateAnimation(); string cryFile = PokemonDatabase.FindCryFile(pokemon.DexID); try { if (cryFile != null) { playerCry.Open(new Uri(cryFile)); } else { playerCry = null; } } catch (Exception) { playerCry = null; } cryFile = PokemonDatabase.FindCryFile(evolutionDexID); try { if (cryFile != null) { playerEvolutionCry.Open(new Uri(cryFile)); } else { playerEvolutionCry = null; } } catch (Exception) { playerEvolutionCry = null; } playerMusic.Open(new Uri(System.IO.Path.Combine(PokeManager.ApplicationDirectory, "Resources", "Audio", "Evolution.wav"))); }
// Caught pokemon, only a few customizable details public Pokemon(Pokemon pokemon, string nickname, Ball caughtBall) { PokemonData thisPokemonData = PokemonDatabase.getPokemon(pokemonID); this.pokemonID = pokemon.pokemonID; this.nickname = nickname; this.form = 0; this.gender = pokemon.gender; this.level = pokemon.level; this.exp = pokemon.exp; this.nextLevelExp = pokemon.nextLevelExp; this.friendship = pokemon.friendship; this.isShiny = pokemon.isShiny; this.status = pokemon.status; this.sleepTurns = pokemon.sleepTurns; this.caughtBall = caughtBall; this.heldItem = pokemon.heldItem; this.OT = "Unknown"; this.metLevel = level; this.metMap = "Somewhere"; this.metDate = System.DateTime.Today.Day + "/" + System.DateTime.Today.Month + "/" + System.DateTime.Today.Year; this.IV_HP = pokemon.IV_HP; this.IV_ATK = pokemon.IV_ATK; this.IV_DEF = pokemon.IV_DEF; this.IV_SPA = pokemon.IV_SPA; this.IV_SPD = pokemon.IV_SPD; this.IV_SPE = pokemon.IV_SPE; this.EV_HP = pokemon.EV_HP; this.EV_ATK = pokemon.EV_ATK; this.EV_DEF = pokemon.EV_DEF; this.EV_SPA = pokemon.EV_SPA; this.EV_SPD = pokemon.EV_SPD; this.EV_SPE = pokemon.EV_SPE; this.nature = pokemon.nature; this.calculateStats(); this.currentHP = pokemon.currentHP; this.ability = pokemon.ability; this.moveset = pokemon.moveset; this.moveHistory = pokemon.moveHistory; this.PPups = pokemon.PPups; this.maxPP = new int[4]; this.PP = new int[4]; for (int i = 0; i < 4; i++) { if (!string.IsNullOrEmpty(moveset[i])) { this.maxPP[i] = Mathf.FloorToInt(MoveDatabase.getMove(moveset[i]).getPP() * ((this.PPups[i] * 0.2f) + 1)); this.PP[i] = this.maxPP[i]; } } packMoveset(); }
private string GetEventDescription(SerializedProperty currentSEvent) { SetEventProps(currentSEvent); //add more details according to which type of event it is CustomEventDetails.CustomEventType ty = (CustomEventDetails.CustomEventType)eventType_Prop.enumValueIndex; //set the event description to be the enum name string eventDescription = ty.ToString(); switch (ty) { case CustomEventDetails.CustomEventType.Walk: eventDescription = (bool0_Prop.boolValue)? "Move " : "Walk "; eventDescription += (object0_Prop.objectReferenceValue != null)? "\"" + object0_Prop.objectReferenceValue.name + "\" " : "\"null\" "; eventDescription += dir_Prop.enumDisplayNames[dir_Prop.enumValueIndex].ToLowerInvariant() + " " + int0_Prop.intValue + " spaces."; break; case CustomEventDetails.CustomEventType.TurnTo: int turns = int0_Prop.intValue; while (turns > 3) { turns -= 4; } while (turns < 0) { turns += 4; } eventDescription = (object0_Prop.objectReferenceValue != null)? "Turn \"" + object0_Prop.objectReferenceValue.name + "\"" : "Turn \"null\""; if (object1_Prop.objectReferenceValue != null) { eventDescription += " towards \"" + object1_Prop.objectReferenceValue.name + "\""; if (turns != 0) { eventDescription += ", then"; } } switch (turns) { case 1: eventDescription += " clockwise."; break; case 2: eventDescription += " around."; break; case 3: eventDescription += " counter clockwise."; break; } break; case CustomEventDetails.CustomEventType.Wait: eventDescription = "Wait " + float0_Prop.floatValue + " seconds."; break; case CustomEventDetails.CustomEventType.Dialog: if (strings_Prop.arraySize > 0) //check for invalid values before attempting to use any. { if (strings_Prop.GetArrayElementAtIndex(0).stringValue != null) { if (strings_Prop.GetArrayElementAtIndex(0).stringValue.Length <= 32) { eventDescription = "\"" + strings_Prop.GetArrayElementAtIndex(0).stringValue + "\""; } else { eventDescription = "\"" + strings_Prop.GetArrayElementAtIndex(0).stringValue.Substring(0, 32) + "... \""; } } } break; case CustomEventDetails.CustomEventType.Choice: eventDescription = "Choices: "; int i = 0; while (eventDescription.Length < 32 && i < strings_Prop.arraySize) { if (strings_Prop.GetArrayElementAtIndex(i).stringValue != null) { eventDescription += strings_Prop.GetArrayElementAtIndex(i).stringValue; if (i + 1 < strings_Prop.arraySize) { eventDescription += ", "; } } i += 1; } if (eventDescription.Length > 32) { eventDescription = eventDescription.Substring(0, 32) + "..."; } break; case CustomEventDetails.CustomEventType.ReceivePokemon: eventDescription = "Receive a Lv. " + ints_Prop.GetArrayElementAtIndex(1).intValue + " \""; PokemonData pkd = PokemonDatabase.getPokemon(ints_Prop.GetArrayElementAtIndex(0).intValue); eventDescription += (pkd != null)? pkd.getName() : "null"; eventDescription += "\" or Jump to " + int0_Prop.intValue + "."; break; case CustomEventDetails.CustomEventType.LogicCheck: CustomEventDetails.Logic lo = (CustomEventDetails.Logic)logic_Prop.enumValueIndex; if (lo == CustomEventDetails.Logic.CVariableEquals) { eventDescription = "If \"" + string0_Prop.stringValue + "\" == " + float0_Prop.floatValue + ", Jump to " + int0_Prop.intValue + "."; } else if (lo == CustomEventDetails.Logic.CVariableGreaterThan) { eventDescription = "If \"" + string0_Prop.stringValue + "\" > " + float0_Prop.floatValue + ", Jump to " + int0_Prop.intValue + "."; } else if (lo == CustomEventDetails.Logic.CVariableLessThan) { eventDescription = "If \"" + string0_Prop.stringValue + "\" < " + float0_Prop.floatValue + ", Jump to " + int0_Prop.intValue + "."; } //Boolean Logic Checks else if (lo == CustomEventDetails.Logic.SpaceInParty) { eventDescription = (bool0_Prop.boolValue)? "If NOT " : "If "; eventDescription += logic_Prop.enumDisplayNames[logic_Prop.enumValueIndex] + ", Jump to " + int0_Prop.intValue + "."; } else { eventDescription = "If " + float0_Prop.floatValue + " " + logic_Prop.enumDisplayNames[logic_Prop.enumValueIndex] + ", Jump to " + int0_Prop.intValue + "."; } break; case CustomEventDetails.CustomEventType.SetCVariable: eventDescription = "Set C Variable \"" + string0_Prop.stringValue + "\" to " + float0_Prop.floatValue + "."; break; case CustomEventDetails.CustomEventType.SetActive: eventDescription = (bool0_Prop.boolValue)? "Activate \"" : "Deactivate \""; eventDescription += (object0_Prop.objectReferenceValue != null)? object0_Prop.objectReferenceValue.name + "\"" : "null\""; break; case CustomEventDetails.CustomEventType.Sound: eventDescription = "Play sound: \""; eventDescription += (sound_Prop.objectReferenceValue != null)? sound_Prop.objectReferenceValue.name + "\"" : "null\""; break; case CustomEventDetails.CustomEventType.ReceiveItem: eventDescription = "Receive " + int0_Prop.intValue + " x \"" + string0_Prop.stringValue + "\""; break; case CustomEventDetails.CustomEventType.TrainerBattle: eventDescription = "Battle with "; eventDescription += (object0_Prop.objectReferenceValue != null)? object0_Prop.objectReferenceValue.name + "\"" : "null\""; if (bool0_Prop.boolValue) { eventDescription += ", Jump To " + int0_Prop.intValue + " on Loss"; } break; } return(eventDescription); }
public override void GenerateReward(IGameSave gameSave) { Random random = new Random((int)DateTime.Now.Ticks); PokemonData pokemonData = PokemonDatabase.GetPokemonFromDexID(DexID); GBAPokemon pkm = new GBAPokemon(); pkm.DexID = DexID; pkm.Personality = (Personality.HasValue ? Personality.Value : (uint)random.Next()); pkm.Experience = PokemonDatabase.GetExperienceFromLevel(pokemonData.ExperienceGroup, (IsEgg ? (byte)5 : Level)); pkm.IsSecondAbility2 = (IsSecondAbility.HasValue ? IsSecondAbility.Value : (!pokemonData.CanOnlyHaveFirstAbility && random.Next(2) == 1)); pkm.Nickname = (Nickname != null ? Nickname : pokemonData.Name.ToUpper()); pkm.BallCaughtID = 4; pkm.MetLocationID = 255; if (DexID == 151 || DexID == 386) { pkm.IsFatefulEncounter = true; } pkm.LevelMet = (IsEgg ? (byte)0 : Level); pkm.Language = Languages.English; pkm.Friendship = (byte)(IsEgg ? 10 : 70); // Ownership pkm.TrainerName = (TrainerName != null ? TrainerName : PokeManager.ManagerGameSave.TrainerName); pkm.TrainerGender = (TrainerGender.HasValue ? TrainerGender.Value : PokeManager.ManagerGameSave.TrainerGender); pkm.TrainerID = (TrainerID.HasValue ? TrainerID.Value : PokeManager.ManagerGameSave.TrainerID); pkm.SecretID = (SecretID.HasValue ? SecretID.Value : PokeManager.ManagerGameSave.SecretID); if (TrainerGender.HasValue && TrainerGender.Value == Genders.Genderless) { pkm.TrainerGender = (random.Next(2) == 1 ? Genders.Female : Genders.Male); } if (!Personality.HasValue) { GeneratePID(pkm, random); } if (HeldItem != null) { pkm.HeldItemID = HeldItem[random.Next(HeldItem.Length)]; } if (Conditions != null) { pkm.Coolness = Conditions[0]; pkm.Beauty = Conditions[1]; pkm.Cuteness = Conditions[2]; pkm.Smartness = Conditions[3]; pkm.Toughness = Conditions[4]; pkm.Feel = Conditions[5]; } pkm.HPIV = (IVs != null ? IVs[0] : (byte)random.Next(32)); pkm.AttackIV = (IVs != null ? IVs[1] : (byte)random.Next(32)); pkm.DefenseIV = (IVs != null ? IVs[2] : (byte)random.Next(32)); pkm.SpAttackIV = (IVs != null ? IVs[3] : (byte)random.Next(32)); pkm.SpDefenseIV = (IVs != null ? IVs[4] : (byte)random.Next(32)); pkm.SpeedIV = (IVs != null ? IVs[5] : (byte)random.Next(32)); if (HiddenPowerDamage.HasValue) { pkm.SetHiddenPowerDamage(HiddenPowerDamage.Value); } if (HiddenPowerType.HasValue) { pkm.SetHiddenPowerType(HiddenPowerType.Value); } // Teach the Pokemon all of it's default moves ushort[] moves = PokemonDatabase.GetMovesLearnedAtLevelRange(pkm, 1, (IsEgg ? (byte)5 : Level)); foreach (ushort moveID in moves) { if (!PokemonDatabase.PokemonHasMove(pkm, moveID)) { if (pkm.NumMoves < 4) { pkm.SetMoveAt(pkm.NumMoves, new Move(moveID)); } else { for (int i = 0; i < 3; i++) { pkm.SetMoveAt(i, pkm.GetMoveAt(i + 1)); } pkm.SetMoveAt(3, new Move(moveID)); } } } if (Move1ID.HasValue) { pkm.SetMoveAt(0, new Move(Move1ID.Value)); } if (Move2ID.HasValue) { pkm.SetMoveAt(1, new Move(Move2ID.Value)); } if (Move3ID.HasValue) { pkm.SetMoveAt(2, new Move(Move3ID.Value)); } if (Move4ID.HasValue) { pkm.SetMoveAt(3, new Move(Move4ID.Value)); } GameTypes gameType = gameSave.GameType; if (gameType == GameTypes.Ruby) { pkm.GameOrigin = GameOrigins.Ruby; } else if (gameType == GameTypes.Sapphire) { pkm.GameOrigin = GameOrigins.Sapphire; } else if (gameType == GameTypes.Emerald) { pkm.GameOrigin = GameOrigins.Emerald; } else if (gameType == GameTypes.FireRed) { pkm.GameOrigin = GameOrigins.FireRed; } else if (gameType == GameTypes.LeafGreen) { pkm.GameOrigin = GameOrigins.LeafGreen; } else if (gameType == GameTypes.Colosseum || gameType == GameTypes.XD) { pkm.GameOrigin = GameOrigins.ColosseumXD; } else { pkm.GameOrigin = GameOrigins.Emerald; } pkm.GameType = gameType; pkm.Checksum = pkm.CalculateChecksum(); pkm.RecalculateStats(); reward = pkm; }
public void LoadPokemon(IPokemon pokemon) { this.pokemon = pokemon; if (PokeManager.IsAprilFoolsMode && !pokemon.IsEgg) { this.imagePokemon.Source = PokemonDatabase.GetPokemonImageFromDexID(41, pokemon.IsShiny); } else { this.imagePokemon.Source = pokemon.Sprite; } if (pokemon.IsShadowPokemon) { this.rectShadowMask.OpacityMask = new ImageBrush(this.imagePokemon.Source); this.rectShadowMask.Visibility = Visibility.Visible; this.imageShadowAura.Visibility = Visibility.Visible; } else { this.rectShadowMask.Visibility = Visibility.Hidden; this.imageShadowAura.Visibility = Visibility.Hidden; } this.imageShinyStar.Visibility = (pokemon.IsShiny && (!pokemon.IsEgg || !PokeManager.Settings.MysteryEggs) ? Visibility.Visible : Visibility.Hidden); this.imageBallCaught.Source = (!pokemon.IsEgg ? PokemonDatabase.GetBallCaughtImageFromID(pokemon.BallCaughtID) : null); if (pokemon.IsEgg) { this.labelNickname.Content = "EGG"; } else { this.labelNickname.Content = pokemon.Nickname; } if (pokemon.HasForm) { this.labelSpecies.Content = pokemon.PokemonFormData.Name; } else { this.labelSpecies.Content = pokemon.PokemonData.Name; } if (pokemon.DexID == 265 && (!pokemon.IsEgg || !PokeManager.Settings.MysteryEggs)) { this.labelSpecies.Content += " " + (pokemon.WurpleIsCascoon ? "(Cas)" : "(Sil)"); } this.labelLevel.Content = "Lv " + pokemon.Level.ToString(); if (pokemon.IsEgg && PokeManager.Settings.MysteryEggs) { this.labelGender.Content = ""; } else if (pokemon.Gender == Genders.Male) { this.labelGender.Content = "♂"; this.labelGender.Foreground = new SolidColorBrush(Color.FromRgb(0, 136, 184)); } else if (pokemon.Gender == Genders.Female) { this.labelGender.Content = "♀"; this.labelGender.Foreground = new SolidColorBrush(Color.FromRgb(184, 88, 80)); } else { this.labelGender.Content = ""; } Brush unmarkedBrush = new SolidColorBrush(Color.FromRgb(200, 200, 200)); Brush markedBrush = new SolidColorBrush(Color.FromRgb(0, 0, 0)); markCircle.Foreground = (pokemon.IsCircleMarked ? markedBrush : unmarkedBrush); markSquare.Foreground = (pokemon.IsSquareMarked ? markedBrush : unmarkedBrush); markTriangle.Foreground = (pokemon.IsTriangleMarked ? markedBrush : unmarkedBrush); markHeart.Foreground = (pokemon.IsHeartMarked ? markedBrush : unmarkedBrush); if (pokemon.IsHoldingItem) { imageHeldItem.Source = ItemDatabase.GetItemImageFromID(pokemon.HeldItemID); } else { imageHeldItem.Source = null; } }
public override void Start() { if (!surfing) { updateMount(false); } updateAnimation("walk", walkFPS); StartCoroutine("animateSprite"); animPause = true; reflect(false); followerScript.reflect(false); updateDirection(direction); StartCoroutine(control()); //Check current map RaycastHit[] hitRays = Physics.RaycastAll(transform.position + Vector3.up, Vector3.down); int closestIndex; float closestDistance; CheckHitRaycastDistance(hitRays, out closestIndex, out closestDistance); if (closestIndex >= 0) { currentMap = hitRays[closestIndex].collider.gameObject.GetComponent <MapCollider>(); } else { //if no map found //Check for map in front of player's direction hitRays = Physics.RaycastAll(transform.position + Vector3.up + getForwardVectorRaw(), Vector3.down); CheckHitRaycastDistance(hitRays, out closestIndex, out closestDistance); if (closestIndex >= 0) { currentMap = hitRays[closestIndex].collider.gameObject.GetComponent <MapCollider>(); } else { Debug.Log("no map found"); } } if (currentMap != null) { accessedMapSettings = currentMap.gameObject.GetComponent <MapSettings>(); AudioClip audioClip = accessedMapSettings.getBGM(); int loopStartSamples = accessedMapSettings.getBGMLoopStartSamples(); if (accessedAudio != audioClip) { //if audio is not already playing accessedAudio = audioClip; accessedAudioLoopStartSamples = loopStartSamples; BgmHandler.main.PlayMain(accessedAudio, accessedAudioLoopStartSamples); } if (accessedMapSettings.showMapName == true) { MapName.display(accessedMapSettings.mapName); } } //check position for transparent bumpEvents Collider transparentCollider = null; Collider[] hitColliders = Physics.OverlapSphere(transform.position, 0.4f); transparentCollider = hitColliders.LastOrDefault(collider => collider.name.ToLowerInvariant().Contains("_transparent") && !collider.name.ToLowerInvariant().Contains("player") && !collider.name.ToLowerInvariant().Contains("follower")); if (transparentCollider != null) { //send bump message to the object's parent object transparentCollider.transform.parent.gameObject.SendMessage("bump", SendMessageOptions.DontRequireReceiver); } //DEBUG if (accessedMapSettings != null) { string pkmnNames = ""; foreach (var encounter in accessedMapSettings.getEncounterList(WildPokemonInitialiser.Location.Standard)) { pkmnNames += PokemonDatabase.getPokemon(encounter.ID).getName() + ", "; } Debug.Log("Wild Pokemon for map \"" + accessedMapSettings.mapName + "\": " + pkmnNames); } // followerScript.resetFollower(); }
//---------------------------------------------------------------------------- protected override void OnInternalInspectorGUI() { PokemonDatabase.PokemonItem item = PokemonDatabase.GetPokemonByIndex(m_currentlySelected); if (item != null) { GUILayout.BeginHorizontal(); { GUILayout.BeginVertical(); { item.m_index = EditorGUILayout.IntField("Pokemon Index", item.m_index); m_oldPokemonName = item.m_name; item.m_name = EditorGUILayout.TextField("Pokemon Name", item.m_name); m_newPokemonName = item.m_name; GUILayout.BeginHorizontal(); { item.m_size = EditorGUILayout.FloatField("Pokemon Size", item.m_size); item.m_weight = EditorGUILayout.FloatField("Pokemon Weight", item.m_weight); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { item.m_tauxCapture = EditorGUILayout.FloatField("Taux Capture", item.m_tauxCapture); item.m_ratioMale = EditorGUILayout.FloatField("Ratio Male", item.m_ratioMale); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { item.m_type1 = (EPokemonType)EditorGUILayout.EnumPopup("Type 1", item.m_type1); item.m_type2 = (EPokemonType)EditorGUILayout.EnumPopup("Type 2", item.m_type2); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { item.m_pv = EditorGUILayout.IntField("Base pv", item.m_pv); item.m_pv_given = EditorGUILayout.IntField("EV pv given", item.m_pv_given); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { item.m_atk = EditorGUILayout.IntField("Base atk", item.m_atk); item.m_atk_given = EditorGUILayout.IntField("EV atk given", item.m_atk_given); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { item.m_def = EditorGUILayout.IntField("Base def", item.m_def); item.m_def_given = EditorGUILayout.IntField("EV def given", item.m_def_given); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { item.m_vitesse = EditorGUILayout.IntField("Base vitesse", item.m_vitesse); item.m_vitesse_given = EditorGUILayout.IntField("EV vitesse given", item.m_vitesse_given); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { item.m_atkspe = EditorGUILayout.IntField("Base atkspe", item.m_atkspe); item.m_atkspe_given = EditorGUILayout.IntField("EV atkspe given", item.m_atkspe_given); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { item.m_defspe = EditorGUILayout.IntField("Base defspe", item.m_defspe); item.m_defspe_given = EditorGUILayout.IntField("EV defspe given", item.m_defspe_given); } GUILayout.EndHorizontal(); item.m_baseXp = EditorGUILayout.IntField("Base experience", item.m_baseXp); item.m_courbeExp = (ECourbesExperience)EditorGUILayout.EnumPopup("Courbe d'experience", item.m_courbeExp); GUILayout.BeginHorizontal(); { item.m_lvlEvolution = EditorGUILayout.IntField("Level evolution", item.m_lvlEvolution); item.m_evolution = EditorGUILayout.Popup("Evolution", item.m_evolution, m_pokemonNames); } GUILayout.EndHorizontal(); //item.m_sprite_fight_face = EditorGUILayout.ObjectField ("Sprite combat face", item.m_sprite_fight_face, typeof(Sprite), false) as Sprite; //item.m_sprite_fight_back = EditorGUILayout.ObjectField ("Sprite combat back", item.m_sprite_fight_back, typeof(Sprite), false) as Sprite; // Attack list GUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Attacks by level"); if (GUILayout.Button(m_listUnfolded ? "Hide" : "Show")) { m_listUnfolded = !m_listUnfolded; } } GUILayout.EndHorizontal(); if (m_listUnfolded) { foreach (PokemonDatabase.PokemonAttack element in item.m_attacksByLvl) { GUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(" ", GUILayout.MaxWidth(40)); element.m_level = EditorGUILayout.IntField("Level", element.m_level); EditorGUILayout.LabelField(" ", GUILayout.Width(40)); element.m_attackId = EditorGUILayout.Popup("Attack", element.m_attackId, m_attackNames); EditorGUILayout.LabelField(" ", GUILayout.Width(40)); if (GUILayout.Button("-")) { m_delete = true; m_elementToDelete = new KeyValuePair <int, PokemonDatabase.PokemonAttack> (item.m_index, element); } } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(" ", GUILayout.MaxWidth(40)); if (GUILayout.Button("+")) { AddNewLevelAttack(item.m_index); } } GUILayout.EndHorizontal(); } } GUILayout.EndVertical(); GUILayout.BeginVertical(); { item.m_sprite_fight_face = EditorGUILayout.ObjectField("Sprite combat face", item.m_sprite_fight_face, typeof(Sprite), false) as Sprite; /*Rect rect_fight_face = GUILayoutUtility.GetRect(75.0f, 75.0f, GUILayout.MaxWidth(75.0f)); * if (item.m_sprite_fight_face) * { * GUI.DrawTexture(rect_fight_face, item.m_sprite_fight_face.texture); * }*/ } GUILayout.EndVertical(); GUILayout.BeginVertical(); { item.m_sprite_fight_back = EditorGUILayout.ObjectField("Sprite combat back", item.m_sprite_fight_back, typeof(Sprite), false) as Sprite; /*Rect rect_fight_back = GUILayoutUtility.GetRect(75.0f, 75.0f, GUILayout.MaxWidth(75.0f)); * if (item.m_sprite_fight_back) * { * GUI.DrawTexture(rect_fight_back, item.m_sprite_fight_back.texture); * }*/ } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); } // Delay deletion so we don't do it during the for each loop if (m_delete) { RemoveLevelAttack(m_elementToDelete.Key, m_elementToDelete.Value); m_delete = false; } if (GUI.changed) { //Can't have same double type if (item.m_type1 == item.m_type2) { item.m_type2 = EPokemonType.Default; } UpdatePokemonNamesList(); EditorUtility.SetDirty(target); } }
private void FillGridItem(ushort dexID) { Grid grid = stackPanelList.Children[dexID - 1] as Grid; grid.Width = double.NaN; grid.HorizontalAlignment = HorizontalAlignment.Stretch; grid.Height = 64 + 18; grid.IsHitTestVisible = true; grid.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)); grid.Children.Clear(); Label labelName = new Label(); if (dexID == 387) { labelName.Content = "Egg - Pokémon Egg"; } else { labelName.Content = "No" + dexID.ToString("000") + " - " + PokemonDatabase.GetPokemonFromDexID(dexID).Name; } labelName.Padding = new Thickness(5, 1, 5, 1); labelName.FontWeight = FontWeights.Bold; labelName.VerticalAlignment = VerticalAlignment.Top; labelName.IsHitTestVisible = false; StackPanel stackPanel = new StackPanel(); stackPanel.Margin = new Thickness(0, 18, 0, 0); stackPanel.HorizontalAlignment = HorizontalAlignment.Stretch; stackPanel.VerticalAlignment = VerticalAlignment.Stretch; stackPanel.Orientation = Orientation.Horizontal; stackPanel.Height = 64; stackPanel.Width = double.NaN; bool hasFRLG = PokemonDatabase.HasPokemonImageType(dexID, FrontSpriteSelectionTypes.FRLG, shinyMode); bool hasCustom = PokemonDatabase.HasPokemonImageType(dexID, FrontSpriteSelectionTypes.Custom, shinyMode); stackPanel.Children.Add(CreateSpriteSelection(dexID, FrontSpriteSelectionTypes.RSE)); if (hasFRLG) { stackPanel.Children.Add(CreateSpriteSelection(dexID, FrontSpriteSelectionTypes.FRLG)); } else { stackPanel.Children.Add(CreateBlankSpriteSelection(dexID, FrontSpriteSelectionTypes.FRLG)); } if (hasCustom) { stackPanel.Children.Add(CreateSpriteSelection(dexID, FrontSpriteSelectionTypes.Custom)); } else { stackPanel.Children.Add(CreateBlankSpriteSelection(dexID, FrontSpriteSelectionTypes.Custom)); } grid.Children.Add(stackPanel); grid.Children.Add(labelName); grid.Visibility = ((!hasFRLG && !hasCustom) ? Visibility.Collapsed : Visibility.Visible); grid.Tag = dexID; }
//---------------------------------------------------------------------------- void AddNewLevelAttack(int index) { PokemonDatabase.CreateNewLevelAttack(index); }
//---------------------------------------------------------------------------- void RemoveLevelAttack(int index, PokemonDatabase.PokemonAttack element) { PokemonDatabase.RemoveLevelAttack(index, element); }
//---------------------------------------------------------------------------- protected override void AddToList(ReorderableList list) { PokemonDatabase.CreateNewPokemon(); base.AddToList(list); }
private void PopulateComboBoxes() { bool oldLoaded = loaded; loaded = false; AddComparisonComboBoxItems(comboBoxHatchCounterComparison); AddComparisonComboBoxItems(comboBoxStatComparison); AddComparisonComboBoxItems(comboBoxConditionComparison); AddComparisonComboBoxItems(comboBoxIVComparison); AddComparisonComboBoxItems(comboBoxEVComparison); AddComparisonComboBoxItems(comboBoxLevelComparison); AddComparisonComboBoxItems(comboBoxFriendshipComparison); AddComparisonComboBoxItems(comboBoxHiddenPowerDamageComparison); comboBoxSpecies.Items.Clear(); for (ushort i = 1; i <= 386; i++) { AddComboBoxItem(comboBoxSpecies, PokemonDatabase.GetPokemonFromDexID(i).Name, (int)i); } comboBoxType.Items.Clear(); for (PokemonTypes i = PokemonTypes.Normal; i <= PokemonTypes.Dark; i++) { AddComboBoxItem(comboBoxType, i.ToString(), (int)i); } comboBoxNature.Items.Clear(); for (byte i = 0; i <= 24; i++) { AddComboBoxItem(comboBoxNature, PokemonDatabase.GetNatureFromID(i).Name, (int)i); } comboBoxAbility.Items.Clear(); for (byte i = 1; i <= 76; i++) { AddComboBoxItem(comboBoxAbility, PokemonDatabase.GetAbilityFromID(i).Name, (int)i); } comboBoxHeldItem.Items.Clear(); AddComboBoxItem(comboBoxHeldItem, "Any", 0); for (int i = 1; ItemDatabase.GetItemAt(i) != null; i++) { ItemData item = ItemDatabase.GetItemAt(i); if (!item.IsImportant && item.ID < 500) { AddComboBoxItem(comboBoxHeldItem, item.Name, (int)item.ID); } } comboBoxPokeBall.Items.Clear(); AddComboBoxItem(comboBoxPokeBall, "Poké Ball", 4); AddComboBoxItem(comboBoxPokeBall, "Great Ball", 3); AddComboBoxItem(comboBoxPokeBall, "Ultra Ball", 2); AddComboBoxItem(comboBoxPokeBall, "Master Ball", 1); AddComboBoxItem(comboBoxPokeBall, "Safari Ball", 5); AddComboBoxItem(comboBoxPokeBall, "Timer Ball", 10); AddComboBoxItem(comboBoxPokeBall, "Repeat Ball", 9); AddComboBoxItem(comboBoxPokeBall, "Net Ball", 6); AddComboBoxItem(comboBoxPokeBall, "Dive Ball", 7); AddComboBoxItem(comboBoxPokeBall, "Nest Ball", 8); AddComboBoxItem(comboBoxPokeBall, "Premier Ball", 12); AddComboBoxItem(comboBoxPokeBall, "Luxury Ball", 11); comboBoxRibbon.Items.Clear(); for (PokemonRibbons i = PokemonRibbons.Any; i <= PokemonRibbons.World; i++) { // Add spaces to the names string name = i.ToString(); StringBuilder newName = new StringBuilder(); foreach (char c in name) { if (char.IsUpper(c) && newName.Length > 0) { newName.Append(' '); } newName.Append(c); } AddComboBoxItem(comboBoxRibbon, newName.ToString(), (int)i); } comboBoxPokerus.Items.Clear(); AddComboBoxItem(comboBoxPokerus, "None", (int)PokerusStatuses.None); AddComboBoxItem(comboBoxPokerus, "Infected", (int)PokerusStatuses.Infected); AddComboBoxItem(comboBoxPokerus, "Cured", (int)PokerusStatuses.Cured); ComboBox[] statComboBoxes = new ComboBox[] { comboBoxStatType, comboBoxIVType, comboBoxEVType }; for (int i = 0; i < 3; i++) { statComboBoxes[i].Items.Clear(); AddComboBoxItem(statComboBoxes[i], "HP", (int)StatTypes.HP); AddComboBoxItem(statComboBoxes[i], "Attack", (int)StatTypes.Attack); AddComboBoxItem(statComboBoxes[i], "Defense", (int)StatTypes.Defense); AddComboBoxItem(statComboBoxes[i], "Sp Attack", (int)StatTypes.SpAttack); AddComboBoxItem(statComboBoxes[i], "Sp Defense", (int)StatTypes.SpDefense); AddComboBoxItem(statComboBoxes[i], "Speed", (int)StatTypes.Speed); AddComboBoxItem(statComboBoxes[i], "Any", (int)StatTypes.Any); AddComboBoxItem(statComboBoxes[i], "All", (int)StatTypes.All); AddComboBoxItem(statComboBoxes[i], "Total", (int)StatTypes.Total); } comboBoxConditionType.Items.Clear(); AddComboBoxItem(comboBoxConditionType, "Cool", (int)ConditionTypes.Cool); AddComboBoxItem(comboBoxConditionType, "Beauty", (int)ConditionTypes.Beauty); AddComboBoxItem(comboBoxConditionType, "Cute", (int)ConditionTypes.Cute); AddComboBoxItem(comboBoxConditionType, "Smart", (int)ConditionTypes.Smart); AddComboBoxItem(comboBoxConditionType, "Tough", (int)ConditionTypes.Tough); AddComboBoxItem(comboBoxConditionType, "Feel", (int)ConditionTypes.Feel); AddComboBoxItem(comboBoxConditionType, "Any", (int)ConditionTypes.Any); AddComboBoxItem(comboBoxConditionType, "All", (int)ConditionTypes.All); AddComboBoxItem(comboBoxConditionType, "Total", (int)ConditionTypes.Total); comboBoxGender.Items.Clear(); AddComboBoxItem(comboBoxGender, "Male", (int)Genders.Male); AddComboBoxItem(comboBoxGender, "Female", (int)Genders.Female); AddComboBoxItem(comboBoxGender, "Genderless", (int)Genders.Genderless); comboBoxFamily.Items.Clear(); for (ushort i = 1; i <= 386; i++) { PokemonData pokemonData = PokemonDatabase.GetPokemonFromDexID(i); if (pokemonData.FamilyDexID == i) { AddComboBoxItem(comboBoxFamily, pokemonData.Name, (int)i); } } ComboBox[] moveComboBoxes = new ComboBox[] { comboBoxMove1, comboBoxMove2, comboBoxMove3, comboBoxMove4 }; for (int i = 0; i < 4; i++) { moveComboBoxes[i].Items.Clear(); AddComboBoxItem(moveComboBoxes[i], "None", 0); for (ushort j = 1; j <= 354; j++) { AddComboBoxItem(moveComboBoxes[i], PokemonDatabase.GetMoveFromID(j).Name, (int)j); } } comboBoxHiddenPowerType.Items.Clear(); for (PokemonTypes i = PokemonTypes.Fighting; i <= PokemonTypes.Dark; i++) { AddComboBoxItem(comboBoxHiddenPowerType, i.ToString(), (int)i); } comboBoxEggGroup.Items.Clear(); for (EggGroups i = EggGroups.Field; i <= EggGroups.Ditto; i++) { AddComboBoxItem(comboBoxEggGroup, PokemonDatabase.GetEggGroupName(i), (int)i); } comboBoxEggMode.Items.Clear(); AddComboBoxItem(comboBoxEggMode, "Include Eggs", (int)EggModes.IncludeEggs); AddComboBoxItem(comboBoxEggMode, "Exclude Eggs", (int)EggModes.ExcludeEggs); AddComboBoxItem(comboBoxEggMode, "Only Eggs", (int)EggModes.OnlyEggs); comboBoxShinyMode.Items.Clear(); AddComboBoxItem(comboBoxShinyMode, "Include Shinies", (int)ShinyModes.IncludeShinies); AddComboBoxItem(comboBoxShinyMode, "Exclude Shinies", (int)ShinyModes.ExcludeShinies); AddComboBoxItem(comboBoxShinyMode, "Only Shinies", (int)ShinyModes.OnlyShinies); comboBoxShadowMode.Items.Clear(); AddComboBoxItem(comboBoxShadowMode, "Include Shadow", (int)ShadowModes.IncludeShadow); AddComboBoxItem(comboBoxShadowMode, "Exclude Shadow", (int)ShadowModes.ExcludeShadow); AddComboBoxItem(comboBoxShadowMode, "Only Shadow", (int)ShadowModes.OnlyShadow); comboBoxSortMethod.Items.Clear(); AddComboBoxItem(comboBoxSortMethod, "None", (int)SortMethods.None); AddComboBoxItem(comboBoxSortMethod, "Dex Number", (int)SortMethods.DexNumber); AddComboBoxItem(comboBoxSortMethod, "Alphabetical", (int)SortMethods.Alphabetical); AddComboBoxItem(comboBoxSortMethod, "Level", (int)SortMethods.Level); AddComboBoxItem(comboBoxSortMethod, "Friendship", (int)SortMethods.Friendship); AddComboBoxItem(comboBoxSortMethod, "Hatch Counter", (int)SortMethods.HatchCounter); AddComboBoxItem(comboBoxSortMethod, "Type", (int)SortMethods.Type); AddComboBoxItem(comboBoxSortMethod, "Hidden Power Type", (int)SortMethods.HiddenPowerType); AddComboBoxItem(comboBoxSortMethod, "Hidden Power Damage", (int)SortMethods.HiddenPowerDamage); AddComboBoxItem(comboBoxSortMethod, "Total Stats", (int)SortMethods.TotalStats); AddComboBoxItem(comboBoxSortMethod, "Total IVs", (int)SortMethods.TotalIVs); AddComboBoxItem(comboBoxSortMethod, "Total EVs", (int)SortMethods.TotalEVs); AddComboBoxItem(comboBoxSortMethod, "Total Conditions", (int)SortMethods.TotalCondition); AddComboBoxItem(comboBoxSortMethod, "Ribbon Count", (int)SortMethods.RibbonCount); AddComboBoxItem(comboBoxSortMethod, "HP", (int)SortMethods.HP); AddComboBoxItem(comboBoxSortMethod, "Attack", (int)SortMethods.Attack); AddComboBoxItem(comboBoxSortMethod, "Defense", (int)SortMethods.Defense); AddComboBoxItem(comboBoxSortMethod, "Sp Attack", (int)SortMethods.SpAttack); AddComboBoxItem(comboBoxSortMethod, "Sp Defense", (int)SortMethods.SpDefense); AddComboBoxItem(comboBoxSortMethod, "Speed", (int)SortMethods.Speed); AddComboBoxItem(comboBoxSortMethod, "HP IV", (int)SortMethods.HPIV); AddComboBoxItem(comboBoxSortMethod, "Attack IV", (int)SortMethods.AttackIV); AddComboBoxItem(comboBoxSortMethod, "Defense IV", (int)SortMethods.DefenseIV); AddComboBoxItem(comboBoxSortMethod, "Sp Attack IV", (int)SortMethods.SpAttackIV); AddComboBoxItem(comboBoxSortMethod, "Sp Defense IV", (int)SortMethods.SpDefenseIV); AddComboBoxItem(comboBoxSortMethod, "Speed IV", (int)SortMethods.SpeedIV); AddComboBoxItem(comboBoxSortMethod, "HP EV", (int)SortMethods.HPEV); AddComboBoxItem(comboBoxSortMethod, "Attack EV", (int)SortMethods.AttackEV); AddComboBoxItem(comboBoxSortMethod, "Defense EV", (int)SortMethods.DefenseEV); AddComboBoxItem(comboBoxSortMethod, "Sp Attack EV", (int)SortMethods.SpAttackEV); AddComboBoxItem(comboBoxSortMethod, "Sp Defense EV", (int)SortMethods.SpDefenseEV); AddComboBoxItem(comboBoxSortMethod, "Speed EV", (int)SortMethods.SpeedEV); AddComboBoxItem(comboBoxSortMethod, "Coolness", (int)SortMethods.Coolness); AddComboBoxItem(comboBoxSortMethod, "Beauty", (int)SortMethods.Beauty); AddComboBoxItem(comboBoxSortMethod, "Cuteness", (int)SortMethods.Cuteness); AddComboBoxItem(comboBoxSortMethod, "Smartness", (int)SortMethods.Smartness); AddComboBoxItem(comboBoxSortMethod, "Toughness", (int)SortMethods.Toughness); AddComboBoxItem(comboBoxSortMethod, "Feel", (int)SortMethods.Feel); comboBoxSortOrder.Items.Clear(); AddComboBoxItem(comboBoxSortOrder, "Highest to Lowest", (int)SortOrders.HighestToLowest); AddComboBoxItem(comboBoxSortOrder, "Lowest to Highest", (int)SortOrders.LowestToHighest); comboBoxSearchMode.Items.Clear(); AddComboBoxItem(comboBoxSearchMode, "New Search", (int)SearchModes.NewSearch); AddComboBoxItem(comboBoxSearchMode, "Add Results", (int)SearchModes.AddResults); AddComboBoxItem(comboBoxSearchMode, "Refine Results", (int)SearchModes.RefineResults); loaded = oldLoaded; }
private void OnGameSelectionChanged(object sender, SelectionChangedEventArgs e) { if (!loaded) { return; } gameIndex = comboBoxGame.SelectedGameIndex; ItemPocket pocket = PokeManager.GetGameSaveAt(gameIndex).Inventory.Items[ItemTypes.PokeBalls]; listViewBalls.Items.Clear(); selectedIndex = -1; selectedItem = null; for (int i = 0; i < pocket.SlotsUsed; i++) { Item item = pocket[i]; ListViewItem listViewItem = new ListViewItem(); listViewItem.SnapsToDevicePixels = true; listViewItem.UseLayoutRounding = true; DockPanel dockPanel = new DockPanel(); dockPanel.Width = 170; Image image = new Image(); image.Source = PokemonDatabase.GetBallCaughtImageFromID((byte)item.ID); image.Stretch = Stretch.None; image.SnapsToDevicePixels = true; image.UseLayoutRounding = true; image.HorizontalAlignment = HorizontalAlignment.Center; image.VerticalAlignment = VerticalAlignment.Center; TextBlock itemName = new TextBlock(); itemName.VerticalAlignment = VerticalAlignment.Center; itemName.Text = ItemDatabase.GetItemFromID(item.ID).Name; itemName.TextTrimming = TextTrimming.CharacterEllipsis; itemName.Margin = new Thickness(4, 0, 0, 0); TextBlock itemX = new TextBlock(); itemX.VerticalAlignment = VerticalAlignment.Center; itemX.HorizontalAlignment = HorizontalAlignment.Right; itemX.TextAlignment = TextAlignment.Right; itemX.Text = "x"; itemX.Width = Double.NaN; itemX.MinWidth = 10; TextBlock itemCount = new TextBlock(); itemCount.VerticalAlignment = VerticalAlignment.Center; itemCount.HorizontalAlignment = HorizontalAlignment.Right; itemCount.TextAlignment = TextAlignment.Right; itemCount.Width = 30; itemCount.Text = item.Count.ToString(); listViewItem.Content = dockPanel; listViewBalls.Items.Add(listViewItem); dockPanel.Children.Add(image); dockPanel.Children.Add(itemName); dockPanel.Children.Add(itemCount); dockPanel.Children.Add(itemX); DockPanel.SetDock(image, Dock.Left); DockPanel.SetDock(itemCount, Dock.Right); } }
// New pokemon with all details public Pokemon(int pokemonID, string nickname, Gender gender, int level, bool isShiny, Ball caughtBall, string heldItem, string OT, int IV_HP, int IV_ATK, int IV_DEF, int IV_SPA, int IV_SPD, int IV_SPE, int EV_HP, int EV_ATK, int EV_DEF, int EV_SPA, int EV_SPD, int EV_SPE, string nature, int ability, string[] moveset, int[] PPups) { PokemonData thisPokemonData = PokemonDatabase.getPokemon(pokemonID); this.pokemonID = pokemonID; this.nickname = nickname; this.form = 0; this.gender = gender; if (gender == Gender.CALCULATE) { if (thisPokemonData.getMaleRatio() < 0) { this.gender = Gender.NONE; } else if (Random.Range(0f, 100f) <= thisPokemonData.getMaleRatio()) { this.gender = Gender.MALE; } else { this.gender = Gender.FEMALE; } } this.level = level; this.exp = PokemonDatabase.getLevelExp(level); this.nextLevelExp = PokemonDatabase.getLevelExp(level + 1); this.friendship = thisPokemonData.getBaseFriendship(); this.isShiny = isShiny; this.status = Status.NONE; this.sleepTurns = 0; this.caughtBall = caughtBall; this.heldItem = heldItem; this.OT = (string.IsNullOrEmpty(OT) ? "Unknown" : OT); this.metLevel = level; this.metMap = "Somewhere"; this.metDate = System.DateTime.Today.Day + "/" + System.DateTime.Today.Month + "/" + System.DateTime.Today.Year; this.IV_HP = IV_HP; this.IV_ATK = IV_ATK; this.IV_DEF = IV_DEF; this.IV_SPA = IV_SPA; this.IV_SPD = IV_SPD; this.IV_SPE = IV_SPE; this.EV_HP = EV_HP; this.EV_ATK = EV_ATK; this.EV_DEF = EV_DEF; this.EV_SPA = EV_SPA; this.EV_SPD = EV_SPD; this.EV_SPE = EV_SPE; this.nature = nature; this.calculateStats(); this.currentHP = HP; this.ability = ability; this.moveset = moveset; this.moveHistory = moveset; this.PPups = PPups; this.maxPP = new int[4]; this.PP = new int[4]; for (int i = 0; i < 4; i++) { if (!string.IsNullOrEmpty(moveset[i])) { this.maxPP[i] = Mathf.FloorToInt(MoveDatabase.getMove(moveset[i]).getPP() * ((this.PPups[i] * 0.2f) + 1)); this.PP[i] = this.maxPP[i]; } } packMoveset(); }
private UIElement CreateSpriteSelection(ushort dexID, FrontSpriteSelectionTypes type) { Grid grid = new Grid(); // Spinda has spot drawing code so we're not allowed to change him if (dexID != 327) { grid.PreviewMouseDown += OnSpriteSelectionClicked; grid.MouseEnter += OnSpriteSelectionEnter; grid.MouseLeave += OnSpriteSelectionLeave; if (PokeManager.Settings.FrontSpriteSelections[shinyMode ? 1 : 0, dexID - 1] == type) { grid.Background = spriteUnhighlightChecked; } else { grid.Background = spriteUnhighlight; } } else { grid.Background = spriteDisabled; } grid.Width = 64; grid.Height = 64; Image sprite = new Image(); sprite.Width = 64; sprite.Height = 64; sprite.IsHitTestVisible = false; if (type == FrontSpriteSelectionTypes.RSE) { if (shinyMode) { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).ShinyImage; } else { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).Image; } } else if (type == FrontSpriteSelectionTypes.FRLG) { if (shinyMode) { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).FRLGShinyImage; } else { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).FRLGImage; } } else { if (shinyMode) { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).CustomShinyImage; } else { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).CustomImage; } } grid.Children.Add(sprite); grid.Tag = new SpriteSelecionTag { DexID = dexID, Type = type }; return(grid); }
private void updateSelection(Pokemon selectedPokemon) { frame = 0; PlayCry(selectedPokemon); selectedCaughtBall.sprite = Resources.Load <Sprite>("null"); selectedCaughtBall.sprite = Resources.Load <Sprite>("PCSprites/summary" + selectedPokemon.getCaughtBall()); selectedName.text = selectedPokemon.getName(); selectedNameShadow.text = selectedName.text; if (selectedPokemon.getGender() == Pokemon.Gender.FEMALE) { selectedGender.text = "♀"; selectedGender.color = new Color(1, 0.2f, 0.2f, 1); } else if (selectedPokemon.getGender() == Pokemon.Gender.MALE) { selectedGender.text = "♂"; selectedGender.color = new Color(0.2f, 0.4f, 1, 1); } else { selectedGender.text = null; } selectedGenderShadow.text = selectedGender.text; selectedLevel.text = "" + selectedPokemon.getLevel(); selectedLevelShadow.text = selectedLevel.text; selectedSpriteAnimation = selectedPokemon.GetFrontAnim_(); if (selectedSpriteAnimation.Length > 0) { selectedSprite.sprite = selectedSpriteAnimation[0]; } if (string.IsNullOrEmpty(selectedPokemon.getHeldItem())) { selectedHeldItem.text = "None"; } else { selectedHeldItem.text = selectedPokemon.getHeldItem(); } selectedHeldItemShadow.text = selectedHeldItem.text; if (selectedPokemon.getStatus() != Pokemon.Status.NONE) { selectedStatus.sprite = Resources.Load <Sprite>("PCSprites/status" + selectedPokemon.getStatus().ToString()); } else { selectedStatus.sprite = Resources.Load <Sprite>("null"); } if (selectedPokemon.getIsShiny()) { selectedShiny.sprite = Resources.Load <Sprite>("PCSprites/shiny"); } else { selectedShiny.sprite = Resources.Load <Sprite>("null"); } dexNo.text = selectedPokemon.getLongID(); dexNoShadow.text = dexNo.text; species.text = PokemonDatabase.getPokemon(selectedPokemon.getID()).getName(); speciesShadow.text = species.text; string type1string = PokemonDatabase.getPokemon(selectedPokemon.getID()).getType1().ToString(); string type2string = PokemonDatabase.getPokemon(selectedPokemon.getID()).getType2().ToString(); type1.sprite = Resources.Load <Sprite>("null"); type2.sprite = Resources.Load <Sprite>("null"); if (type1string != "NONE") { type1.sprite = Resources.Load <Sprite>("PCSprites/type" + type1string); type1.rectTransform.localPosition = new Vector3(71, type1.rectTransform.localPosition.y); } if (type2string != "NONE") { type2.sprite = Resources.Load <Sprite>("PCSprites/type" + type2string); } else { //if single type pokemon, center the type icon type1.rectTransform.localPosition = new Vector3(89, type1.rectTransform.localPosition.y); } OT.text = selectedPokemon.getOT(); OTShadow.text = OT.text; IDNo.text = "" + selectedPokemon.getIDno(); IDNoShadow.text = IDNo.text; expPoints.text = "" + selectedPokemon.getExp(); expPointsShadow.text = expPoints.text; float expCurrentLevel = PokemonDatabase.getLevelExp(PokemonDatabase.getPokemon(selectedPokemon.getID()).getLevelingRate(), selectedPokemon.getLevel()); float expNextlevel = PokemonDatabase.getLevelExp(PokemonDatabase.getPokemon(selectedPokemon.getID()).getLevelingRate(), selectedPokemon.getLevel() + 1); float expAlong = selectedPokemon.getExp() - expCurrentLevel; float expDistance = expAlong / (expNextlevel - expCurrentLevel); toNextLevel.text = "" + (expNextlevel - selectedPokemon.getExp()); toNextLevelShadow.text = toNextLevel.text; expBar.rectTransform.sizeDelta = new Vector2(Mathf.Floor(expDistance * 64f), expBar.rectTransform.sizeDelta.y); string natureFormatted = selectedPokemon.getNature(); natureFormatted = natureFormatted.Substring(0, 1) + natureFormatted.Substring(1).ToLowerInvariant(); nature.text = "<color=#F22F>" + natureFormatted + "</color> nature."; natureShadow.text = natureFormatted + " nature."; metDate.text = "Met on " + selectedPokemon.getMetDate(); metDateShadow.text = metDate.text; metMap.text = "<color=#F22F>" + selectedPokemon.getMetMap() + "</color>"; metMapShadow.text = selectedPokemon.getMetMap(); metLevel.text = "Met at Level " + selectedPokemon.getMetLevel() + "."; metLevelShadow.text = metLevel.text; string[][] characteristics = new string[][] { new string[] { "Loves to eat", "Takes plenty of siestas", "Nods off a lot", "Scatters things often", "Likes to relax" }, new string[] { "Proud of its power", "Likes to thrash about", "A little quick tempered", "Likes to fight", "Quick tempered" }, new string[] { "Sturdy body", "Capable of taking hits", "Highly persistent", "Good endurance", "Good perseverance" }, new string[] { "Highly curious", "Mischievous", "Thoroughly cunning", "Often lost in thought", "Very finicky" }, new string[] { "Strong willed", "Somewhat vain", "Strongly defiant", "Hates to lose", "Somewhat stubborn" }, new string[] { "Likes to run", "Alert to sounds", "Impetuous and silly", "Somewhat of a clown", "Quick to flee" } }; int highestIV = selectedPokemon.GetHighestIV(); characteristic.text = characteristics[highestIV][selectedPokemon.GetIV(highestIV) % 5] + "."; characteristicShadow.text = characteristic.text; float currentHP = selectedPokemon.getCurrentHP(); float maxHP = selectedPokemon.getHP(); HP.text = currentHP + "/" + maxHP; HPShadow.text = HP.text; HPBar.rectTransform.sizeDelta = new Vector2(selectedPokemon.getPercentHP() * 48f, HPBar.rectTransform.sizeDelta.y); if (currentHP < (maxHP / 4f)) { HPBar.color = new Color(1, 0.125f, 0, 1); } else if (currentHP < (maxHP / 2f)) { HPBar.color = new Color(1, 0.75f, 0, 1); } else { HPBar.color = new Color(0.125f, 1, 0.065f, 1); } float[] natureMod = new float[] { NatureDatabase.getNature(selectedPokemon.getNature()).getATK(), NatureDatabase.getNature(selectedPokemon.getNature()).getDEF(), NatureDatabase.getNature(selectedPokemon.getNature()).getSPA(), NatureDatabase.getNature(selectedPokemon.getNature()).getSPD(), NatureDatabase.getNature(selectedPokemon.getNature()).getSPE() }; Stats.text = selectedPokemon.getATK() + "\n" + selectedPokemon.getDEF() + "\n" + selectedPokemon.getSPA() + "\n" + selectedPokemon.getSPD() + "\n" + selectedPokemon.getSPE(); StatsShadow.text = Stats.text; string[] statsLines = new string[] { "Attack", "Defence", "Sp. Atk", "Sp. Def", "Speed" }; StatsTextShadow.text = ""; for (int i = 0; i < 5; i++) { if (natureMod[i] > 1) { StatsTextShadow.text += "<color=#A01010FF>" + statsLines[i] + "</color>\n"; } else if (natureMod[i] < 1) { StatsTextShadow.text += "<color=#0030A2FF>" + statsLines[i] + "</color>\n"; } else { StatsTextShadow.text += statsLines[i] + "\n"; } } abilityName.text = PokemonDatabase.getPokemon(selectedPokemon.getID()).getAbility(selectedPokemon.getAbility()); abilityNameShadow.text = abilityName.text; //abilities not yet implemented abilityDescription.text = ""; abilityDescriptionShadow.text = abilityDescription.text; updateSelectionMoveset(selectedPokemon); }
private void OnRefreshClicked(object sender, RoutedEventArgs e) { PokemonDatabase.ReloadCustomPokemonSprites(); UpdateList(true); }
void Start() { if (!surfing) { updateMount(false); } updateAnimation("walk", walkFPS); StartCoroutine("animateSprite"); animPause = true; reflect(false); followerScript.reflect(false); updateDirection(direction); StartCoroutine(control()); //Check current map RaycastHit[] hitRays = Physics.RaycastAll(transform.position + Vector3.up, Vector3.down); int closestIndex = -1; float closestDistance = float.PositiveInfinity; if (hitRays.Length > 0) { for (int i = 0; i < hitRays.Length; i++) { if (hitRays[i].collider.gameObject.GetComponent <MapCollider>() != null) { if (hitRays[i].distance < closestDistance) { closestDistance = hitRays[i].distance; closestIndex = i; } } } } if (closestIndex != -1) { currentMap = hitRays[closestIndex].collider.gameObject.GetComponent <MapCollider>(); } else { //if no map found //Check for map in front of player's direction hitRays = Physics.RaycastAll(transform.position + Vector3.up + getForwardVectorRaw(), Vector3.down); closestIndex = -1; closestDistance = float.PositiveInfinity; if (hitRays.Length > 0) { for (int i = 0; i < hitRays.Length; i++) { if (hitRays[i].collider.gameObject.GetComponent <MapCollider>() != null) { if (hitRays[i].distance < closestDistance) { closestDistance = hitRays[i].distance; closestIndex = i; } } } } if (closestIndex != -1) { currentMap = hitRays[closestIndex].collider.gameObject.GetComponent <MapCollider>(); } else { Debug.Log("no map found"); } } if (currentMap != null) { accessedMapSettings = currentMap.gameObject.GetComponent <MapSettings>(); if (accessedAudio != accessedMapSettings.getBGM()) { //if audio is not already playing accessedAudio = accessedMapSettings.getBGM(); accessedAudioLoopStartSamples = accessedMapSettings.getBGMLoopStartSamples(); BgmHandler.main.PlayMain(accessedAudio, accessedAudioLoopStartSamples); } if (accessedMapSettings.mapNameBoxTexture != null) { MapName.display(accessedMapSettings.mapNameBoxTexture, accessedMapSettings.mapName, accessedMapSettings.mapNameColor); } } //check position for transparent bumpEvents Collider transparentCollider = null; Collider[] hitColliders = Physics.OverlapSphere(transform.position, 0.4f); if (hitColliders.Length > 0) { for (int i = 0; i < hitColliders.Length; i++) { if (hitColliders[i].name.ToLowerInvariant().Contains("_transparent")) { if (!hitColliders[i].name.ToLowerInvariant().Contains("player") && !hitColliders[i].name.ToLowerInvariant().Contains("follower")) { transparentCollider = hitColliders[i]; } } } } if (transparentCollider != null) { //send bump message to the object's parent object transparentCollider.transform.parent.gameObject.SendMessage("bump", SendMessageOptions.DontRequireReceiver); } //DEBUG if (accessedMapSettings != null) { WildPokemonInitialiser[] encounterList = accessedMapSettings.getEncounterList(WildPokemonInitialiser.Location.Standard); string namez = ""; for (int i = 0; i < encounterList.Length; i++) { namez += PokemonDatabase.getPokemon(encounterList[i].ID).getName() + ", "; } Debug.Log("Wild Pokemon for map \"" + accessedMapSettings.mapName + "\": " + namez); } // GlobalVariables.global.resetFollower(); }
public void SetDEBUGFileData() { //////////////////////////////////////////////////////////////////////////////////////////////////// SaveData.currentSave.playerName = "Ethan"; SaveData.currentSave.playerID = 29482; SaveData.currentSave.isMale = true; SaveData.currentSave.playerOutfit = "hgss"; //PC test SaveData.currentSave.PC.addPokemon(new Pokemon(006, null, Pokemon.Gender.CALCULATE, 3, true, "Poké Ball", "", "Gold", Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32), 0, 0, 0, 0, 0, 0, "ADAMANT", 0, PokemonDatabase.getPokemon(6).GenerateMoveset(42), new int[4])); SaveData.currentSave.PC.addPokemon(new Pokemon(197, Pokemon.Gender.CALCULATE, 34, "Great Ball", "", SaveData.currentSave.playerName, 0)); SaveData.currentSave.PC.addPokemon(new Pokemon(393, Pokemon.Gender.CALCULATE, 6, "Poké Ball", "", SaveData.currentSave.playerName, 0)); SaveData.currentSave.PC.addPokemon(new Pokemon(197, Pokemon.Gender.CALCULATE, 28, "Great Ball", "", SaveData.currentSave.playerName, -1)); SaveData.currentSave.PC.addPokemon(new Pokemon(68, Pokemon.Gender.CALCULATE, 37, "Ultra Ball", "", SaveData.currentSave.playerName, -1)); SaveData.currentSave.PC.addPokemon(new Pokemon(448, Pokemon.Gender.CALCULATE, 56, "Great Ball", "", SaveData.currentSave.playerName, 0)); SaveData.currentSave.PC.addPokemon(new Pokemon(006, Pokemon.Gender.CALCULATE, 37, "Poké Ball", "", SaveData.currentSave.playerName, 0)); SaveData.currentSave.PC.addPokemon(new Pokemon(607, Pokemon.Gender.CALCULATE, 48, "Poké Ball", "", "Bob", 0)); SaveData.currentSave.PC.boxes[1][1].addExp(7100); SaveData.currentSave.PC.addPokemon(new Pokemon(157, Pokemon.Gender.CALCULATE, 51, "Poké Ball", "", SaveData.currentSave.playerName, 0)); SaveData.currentSave.PC.addPokemon(new Pokemon(300, Pokemon.Gender.CALCULATE, 51, "Poké Ball", "", SaveData.currentSave.playerName, 0)); SaveData.currentSave.PC.addPokemon(new Pokemon(393, "Surf Bloke", Pokemon.Gender.MALE, 15, false, "Ultra Ball", "", SaveData.currentSave.playerName, 31, 31, 31, 31, 31, 31, 0, 252, 0, 0, 0, 252, "ADAMANT", 0, new string[] { "Drill Peck", "Surf", "Growl", "Dragon Rage" }, new int[] { 0, 0, 0, 3 })); SaveData.currentSave.PC.boxes[0][1].setNickname("Greg"); SaveData.currentSave.PC.swapPokemon(0, 5, 1, 5); SaveData.currentSave.PC.swapPokemon(0, 3, 1, 11); SaveData.currentSave.PC.swapPokemon(1, 1, 1, 12); SaveData.currentSave.PC.swapPokemon(1, 2, 1, 21); SaveData.currentSave.PC.swapPokemon(0, 5, 1, 3); SaveData.currentSave.PC.swapPokemon(0, 2, 1, 4); SaveData.currentSave.PC.boxes[0][1].setStatus(Pokemon.Status.POISONED); SaveData.currentSave.PC.boxes[0][1].addExp(420); SaveData.currentSave.PC.packParty(); SaveData.currentSave.PC.swapPokemon(0, 0, 0, 2); SaveData.currentSave.PC.boxes[0][0].swapHeldItem("Ultra Ball"); SaveData.currentSave.PC.boxes[0][1].removeHP(56); SaveData.currentSave.PC.boxes[0][4].removeHP(64); SaveData.currentSave.PC.boxes[0][4].removePP(0, 5); SaveData.currentSave.PC.boxes[0][4].removePP(1, 5); SaveData.currentSave.PC.boxes[0][3].removePP(0, 6); SaveData.currentSave.PC.boxes[0][0].removePP(2, 11); //PC.boxes[0][0].setStatus(Pokemon.Status.FROZEN); SaveData.currentSave.PC.boxes[0][2].setStatus(Pokemon.Status.PARALYZED); SaveData.currentSave.PC.boxes[0][3].setStatus(Pokemon.Status.BURNED); SaveData.currentSave.PC.boxes[0][4].setStatus(Pokemon.Status.ASLEEP); SaveData.currentSave.PC.addPokemon(new Pokemon(012, null, Pokemon.Gender.CALCULATE, 35, false, "Great Ball", "", SaveData.currentSave.playerName, 31, 31, 31, 31, 31, 31, 0, 252, 0, 0, 0, 252, "ADAMANT", 0, new string[] { "Ominous Wind", "Sunny Day", "Gust", "Sleep Powder" }, new int[] { 0, 0, 0, 0 })); //SaveData.currentSave.PC.swapPokemon(0,1,3,1); SaveData.currentSave.PC.swapPokemon(0, 2, 3, 2); SaveData.currentSave.PC.swapPokemon(0, 3, 3, 3); SaveData.currentSave.PC.swapPokemon(0, 4, 3, 4); SaveData.currentSave.PC.swapPokemon(0, 5, 3, 5); SaveData.currentSave.PC.packParty(); //Bag test SaveData.currentSave.Bag.addItem("Poké Ball", 9); SaveData.currentSave.Bag.addItem("Miracle Seed", 1); SaveData.currentSave.Bag.addItem("Poké Ball", 3); SaveData.currentSave.Bag.addItem("Charcoal", 1); SaveData.currentSave.Bag.addItem("Potion", 4); SaveData.currentSave.Bag.addItem("Poké Doll", 13); SaveData.currentSave.Bag.addItem("Escape Rope", 4); SaveData.currentSave.Bag.addItem("Fire Stone", 2); SaveData.currentSave.Bag.removeItem("Poké Doll", 10); SaveData.currentSave.Bag.addItem("Stardust", 1); SaveData.currentSave.Bag.addItem("Water Stone", 1); SaveData.currentSave.Bag.addItem("Moon Stone", 1); SaveData.currentSave.Bag.addItem("Super Potion", 2); SaveData.currentSave.Bag.addItem("Great Ball", 4); SaveData.currentSave.Bag.addItem("Psyshock", 1); SaveData.currentSave.Bag.addItem("Bulk Up", 1); SaveData.currentSave.Bag.addItem("Elixir", 2); SaveData.currentSave.Bag.addItem("Ether", 1); SaveData.currentSave.Bag.addItem("Antidote", 1); SaveData.currentSave.Bag.addItem("Full Heal", 1); SaveData.currentSave.Bag.addItem("Rare Candy", 100); SaveData.currentSave.Bag.addItem("Paralyze Heal", 1); SaveData.currentSave.Bag.addItem("Awakening", 1); SaveData.currentSave.Bag.addItem("Burn Heal", 1); SaveData.currentSave.Bag.addItem("Ice Heal", 1); SaveData.currentSave.Bag.addItem("Max Potion", 1); SaveData.currentSave.Bag.addItem("Hyper Potion", 1); //debug code to test custom box names/textures // PC.boxName[1] = "Grassy Box"; // PC.boxTexture[2] = 12; //////////////////////////////////////////////////////////////////////////////////////////////////// //debug code to test trainer card/save SaveData.currentSave.fileCreationDate = "Feb. 14th, 2015"; SaveData.currentSave.playerMoney = 2481; SaveData.currentSave.playerScore = 481; SaveData.currentSave.playerHours = 0; SaveData.currentSave.playerMinutes = 7; SaveData.currentSave.playerSeconds = 12; //////////////////////////////////////////////////////////////////////////////////////////////////// //debug code to test badge box SaveData.currentSave.gymsEncountered = new bool[] { true, true, false, true, true, true, false, false, false, false, false, false }; SaveData.currentSave.gymsBeaten = new bool[] { true, true, false, false, false, true, false, false, false, false, false, false }; SaveData.currentSave.gymsBeatTime = new string[] { "Apr. 27th, 2015", "Apr. 30th, 2015", null, null, null, "May. 1st, 2015", null, null, null, null, null, null }; //////////////////////////////////////////////////////////////////////////////////////////////////// }
private IEnumerator runEvent(CustomEventTree[] treesArray, int index) { CustomEventDetails currentEvent = treesArray[eventTreeIndex].events[index]; CustomEventDetails nextEvent = null; if (index + 1 < treesArray[eventTreeIndex].events.Length) { //if not the last event nextEvent = treesArray[eventTreeIndex].events[index + 1]; } NPCHandler targetNPC = null; CustomEventDetails.CustomEventType ty = currentEvent.eventType; Debug.Log("Run event. Type: " + ty.ToString()); switch (ty) { case (CustomEventDetails.CustomEventType.Wait): yield return(new WaitForSeconds(currentEvent.float0)); break; case (CustomEventDetails.CustomEventType.Walk): if (currentEvent.object0.GetComponent <NPCHandler>() != null) { targetNPC = currentEvent.object0.GetComponent <NPCHandler>(); int initialDirection = targetNPC.direction; targetNPC.direction = (int)currentEvent.dir; for (int i = 0; i < currentEvent.int0; i++) { targetNPC.direction = (int)currentEvent.dir; Vector3 forwardsVector = targetNPC.getForwardsVector(true); if (currentEvent.bool0) { //if direction locked in targetNPC.direction = initialDirection; } while (forwardsVector == new Vector3(0, 0, 0)) { targetNPC.direction = (int)currentEvent.dir; forwardsVector = targetNPC.getForwardsVector(true); if (currentEvent.bool0) { //if direction locked in targetNPC.direction = initialDirection; } yield return(new WaitForSeconds(0.1f)); } targetNPC.setOverrideBusy(true); yield return(StartCoroutine(targetNPC.move(forwardsVector, currentEvent.float0))); targetNPC.setOverrideBusy(false); } targetNPC.setFrameStill(); } //Move the player if set to player if (currentEvent.object0 == PlayerMovement.player.gameObject) { int initialDirection = PlayerMovement.player.direction; PlayerMovement.player.speed = (currentEvent.float0 > 0) ? PlayerMovement.player.walkSpeed / currentEvent.float0 : PlayerMovement.player.walkSpeed; for (int i = 0; i < currentEvent.int0; i++) { PlayerMovement.player.updateDirection((int)currentEvent.dir); Vector3 forwardsVector = PlayerMovement.player.getForwardVector(); if (currentEvent.bool0) { //if direction locked in PlayerMovement.player.updateDirection(initialDirection); } PlayerMovement.player.setOverrideAnimPause(true); yield return (StartCoroutine(PlayerMovement.player.move(forwardsVector, false, currentEvent.bool0))); PlayerMovement.player.setOverrideAnimPause(false); } PlayerMovement.player.speed = PlayerMovement.player.walkSpeed; } break; case (CustomEventDetails.CustomEventType.TurnTo): int direction; float xDistance; float zDistance; if (currentEvent.object0.GetComponent <NPCHandler>() != null) { targetNPC = currentEvent.object0.GetComponent <NPCHandler>(); } if (targetNPC != null) { if (currentEvent.object1 != null) { //calculate target objects's position relative to this objects's and set direction accordingly. xDistance = targetNPC.hitBox.position.x - currentEvent.object1.transform.position.x; zDistance = targetNPC.hitBox.position.z - currentEvent.object1.transform.position.z; if (xDistance >= Mathf.Abs(zDistance)) { //Mathf.Abs() converts zDistance to a positive always. direction = 3; } //this allows for better accuracy when checking orientation. else if (xDistance <= Mathf.Abs(zDistance) * -1) { direction = 1; } else if (zDistance >= Mathf.Abs(xDistance)) { direction = 2; } else { direction = 0; } targetNPC.setDirection(direction); } if (currentEvent.int0 != 0) { direction = targetNPC.direction + currentEvent.int0; while (direction > 3) { direction -= 4; } while (direction < 0) { direction += 4; } targetNPC.setDirection(direction); } } break; case (CustomEventDetails.CustomEventType.Dialog): for (int i = 0; i < currentEvent.strings.Length; i++) { Dialog.drawDialogBox(); yield return(StartCoroutine(Dialog.drawText(currentEvent.strings[i]))); if (i < currentEvent.strings.Length - 1) { while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back")) { yield return(null); } } } if (nextEvent != null) { if (nextEvent.eventType != CustomEventDetails.CustomEventType.Choice) { while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back")) { yield return(null); } if (!EventRequiresDialogBox(nextEvent.eventType)) { Dialog.undrawDialogBox(); } // do not undraw the box if the next event needs it } } else { while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back")) { yield return(null); } Dialog.undrawDialogBox(); } break; case (CustomEventDetails.CustomEventType.Choice): if (currentEvent.strings.Length > 1) { Dialog.drawChoiceBox(currentEvent.strings); yield return(StartCoroutine(Dialog.choiceNavigate(currentEvent.strings))); } else { Dialog.drawChoiceBox(); yield return(StartCoroutine(Dialog.choiceNavigate())); } int chosenIndex = Dialog.chosenIndex; chosenIndex = currentEvent.ints.Length - 1 - chosenIndex; //flip it to reflect the original input Dialog.undrawChoiceBox(); Dialog.undrawDialogBox(); if (chosenIndex < currentEvent.ints.Length) { //only change tree if index is valid if (currentEvent.ints[chosenIndex] != eventTreeIndex && currentEvent.ints[chosenIndex] < treesArray.Length) { JumpToTree(currentEvent.ints[chosenIndex]); } } break; case CustomEventDetails.CustomEventType.Sound: SfxHandler.Play(currentEvent.sound); break; case CustomEventDetails.CustomEventType.ReceiveItem: //Play Good for TM, Average for Item AudioClip itemGetMFX = (currentEvent.bool0) ? Resources.Load <AudioClip>("Audio/mfx/GetGood") : Resources.Load <AudioClip>("Audio/mfx/GetDecent"); BgmHandler.main.PlayMFX(itemGetMFX); string firstLetter = currentEvent.string0.Substring(0, 1).ToLowerInvariant(); Dialog.drawDialogBox(); if (currentEvent.bool0) { Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received TM" + ItemDatabase.getItem(currentEvent.string0).getTMNo() + ": " + currentEvent.string0 + "!"); } else { if (currentEvent.int0 > 1) { Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received " + currentEvent.string0 + "s!"); } else if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" || firstLetter == "u") { Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received an " + currentEvent.string0 + "!"); } else { Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received a " + currentEvent.string0 + "!"); } } yield return(new WaitForSeconds(itemGetMFX.length)); bool itemAdd = SaveData.currentSave.Bag.addItem(currentEvent.string0, currentEvent.int0); Dialog.drawDialogBox(); if (itemAdd) { if (currentEvent.bool0) { yield return (Dialog.StartCoroutine("drawTextSilent", SaveData.currentSave.playerName + " put the TM" + ItemDatabase.getItem(currentEvent.string0).getTMNo() + " \\away into the bag.")); } else { if (currentEvent.int0 > 1) { yield return (Dialog.StartCoroutine("drawTextSilent", SaveData.currentSave.playerName + " put the " + currentEvent.string0 + "s \\away into the bag.")); } else { yield return (Dialog.StartCoroutine("drawTextSilent", SaveData.currentSave.playerName + " put the " + currentEvent.string0 + " \\away into the bag.")); } } while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back")) { yield return(null); } } else { yield return(Dialog.StartCoroutine("drawTextSilent", "But there was no room...")); while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back")) { yield return(null); } } Dialog.undrawDialogBox(); break; case CustomEventDetails.CustomEventType.ReceivePokemon: if (SaveData.currentSave.PC.hasSpace(0)) { //Play Great for Pokemon AudioClip pokeGetMFX = Resources.Load <AudioClip>("Audio/mfx/GetGreat"); PokemonData pkd = PokemonDatabase.getPokemon(currentEvent.ints[0]); string pkName = pkd.getName(); Pokemon.Gender pkGender = Pokemon.Gender.CALCULATE; if (pkd.getMaleRatio() == -1) { pkGender = Pokemon.Gender.NONE; } else if (pkd.getMaleRatio() == 0) { pkGender = Pokemon.Gender.FEMALE; } else if (pkd.getMaleRatio() == 100) { pkGender = Pokemon.Gender.MALE; } else { //if not a set gender if (currentEvent.ints[2] == 0) { pkGender = Pokemon.Gender.MALE; } else if (currentEvent.ints[2] == 1) { pkGender = Pokemon.Gender.FEMALE; } } Dialog.drawDialogBox(); yield return (Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received the " + pkName + "!")); BgmHandler.main.PlayMFX(pokeGetMFX); yield return(new WaitForSeconds(pokeGetMFX.length)); string nickname = currentEvent.strings[0]; if (currentEvent.strings[1].Length == 0) { //If no OT set, allow nicknaming of Pokemon Dialog.drawDialogBox(); yield return (StartCoroutine( Dialog.drawTextSilent("Would you like to give a nickname to \nthe " + pkName + " you received?"))); Dialog.drawChoiceBox(); yield return(StartCoroutine(Dialog.choiceNavigate())); int nicknameCI = Dialog.chosenIndex; Dialog.undrawDialogBox(); Dialog.undrawChoiceBox(); if (nicknameCI == 1) { //give nickname //SfxHandler.Play(selectClip); yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f))); Scene.main.Typing.gameObject.SetActive(true); StartCoroutine(Scene.main.Typing.control(10, "", pkGender, Pokemon.GetIconsFromID_(currentEvent.ints[0], currentEvent.bool0))); while (Scene.main.Typing.gameObject.activeSelf) { yield return(null); } if (Scene.main.Typing.typedString.Length > 0) { nickname = Scene.main.Typing.typedString; } yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f))); } } if (!EventRequiresDialogBox(nextEvent.eventType)) { Dialog.undrawDialogBox(); } int[] IVs = new int[] { Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32) }; if (currentEvent.bool1) { //if using Custom IVs IVs[0] = currentEvent.ints[5]; IVs[1] = currentEvent.ints[6]; IVs[2] = currentEvent.ints[7]; IVs[3] = currentEvent.ints[8]; IVs[4] = currentEvent.ints[9]; IVs[5] = currentEvent.ints[10]; } string pkNature = (currentEvent.ints[3] == 0) ? NatureDatabase.getRandomNature().getName() : NatureDatabase.getNature(currentEvent.ints[3] - 1).getName(); string[] pkMoveset = pkd.GenerateMoveset(currentEvent.ints[1]); for (int i = 0; i < 4; i++) { if (currentEvent.strings[4 + i].Length > 0) { pkMoveset[i] = currentEvent.strings[4 + i]; } } Debug.Log(pkMoveset[0] + ", " + pkMoveset[1] + ", " + pkMoveset[2] + ", " + pkMoveset[3]); Pokemon pk = new Pokemon(currentEvent.ints[0], nickname, pkGender, currentEvent.ints[1], currentEvent.bool0, currentEvent.strings[2], currentEvent.strings[3], currentEvent.strings[1], IVs[0], IVs[1], IVs[2], IVs[3], IVs[4], IVs[5], 0, 0, 0, 0, 0, 0, pkNature, currentEvent.ints[4], pkMoveset, new int[4]); SaveData.currentSave.PC.addPokemon(pk); } else { //jump to new tree JumpToTree(currentEvent.int0); } break; case (CustomEventDetails.CustomEventType.SetActive): if (currentEvent.bool0) { currentEvent.object0.SetActive(true); } else { if (currentEvent.object0 == this.gameObject) { deactivateOnFinish = true; } else if (currentEvent.object0 != PlayerMovement.player.gameObject) { //important to never deactivate the player currentEvent.object0.SetActive(false); } } break; case CustomEventDetails.CustomEventType.SetCVariable: SaveData.currentSave.setCVariable(currentEvent.string0, currentEvent.float0); break; case (CustomEventDetails.CustomEventType.LogicCheck): bool passedCheck = false; CustomEventDetails.Logic lo = currentEvent.logic; switch (lo) { case CustomEventDetails.Logic.CVariableEquals: if (currentEvent.float0 == SaveData.currentSave.getCVariable(currentEvent.string0)) { passedCheck = true; } break; case CustomEventDetails.Logic.CVariableGreaterThan: if (SaveData.currentSave.getCVariable(currentEvent.string0) > currentEvent.float0) { passedCheck = true; } break; case CustomEventDetails.Logic.CVariableLessThan: if (SaveData.currentSave.getCVariable(currentEvent.string0) < currentEvent.float0) { passedCheck = true; } break; case CustomEventDetails.Logic.GymBadgeNoOwned: if (Mathf.FloorToInt(currentEvent.float0) < SaveData.currentSave.gymsBeaten.Length && Mathf.FloorToInt(currentEvent.float0) >= 0) { //ensure input number is valid if (SaveData.currentSave.gymsBeaten[Mathf.FloorToInt(currentEvent.float0)]) { passedCheck = true; } } break; case CustomEventDetails.Logic.GymBadgesEarned: int badgeCount = 0; for (int bi = 0; bi < SaveData.currentSave.gymsBeaten.Length; bi++) { if (SaveData.currentSave.gymsBeaten[bi]) { badgeCount += 1; } } if (badgeCount >= currentEvent.float0) { passedCheck = true; } break; case CustomEventDetails.Logic.PokemonIDIsInParty: for (int pi = 0; pi < 6; pi++) { if (SaveData.currentSave.PC.boxes[0][pi] != null) { if (SaveData.currentSave.PC.boxes[0][pi].getID() == Mathf.FloorToInt(currentEvent.float0)) { passedCheck = true; pi = 6; } } } break; case CustomEventDetails.Logic.SpaceInParty: if (currentEvent.bool0) { if (!SaveData.currentSave.PC.hasSpace(0)) { passedCheck = true; } } else { if (SaveData.currentSave.PC.hasSpace(0)) { passedCheck = true; } } break; } if (passedCheck) { int newTreeIndex = currentEvent.int0; if (newTreeIndex != eventTreeIndex && //only change tree if index is valid newTreeIndex < treesArray.Length) { JumpToTree(newTreeIndex); } } break; case CustomEventDetails.CustomEventType.TrainerBattle: //custom cutouts not yet implemented StartCoroutine(ScreenFade.main.FadeCutout(false, ScreenFade.slowedSpeed, null)); //Automatic LoopStart usage not yet implemented Scene.main.Battle.gameObject.SetActive(true); Trainer trainer = currentEvent.object0.GetComponent <Trainer>(); if (trainer.battleBGM != null) { Debug.Log(trainer.battleBGM.name); BgmHandler.main.PlayOverlay(trainer.battleBGM, trainer.samplesLoopStart); } else { BgmHandler.main.PlayOverlay(Scene.main.Battle.defaultTrainerBGM, Scene.main.Battle.defaultTrainerBGMLoopStart); } Scene.main.Battle.gameObject.SetActive(false); yield return(new WaitForSeconds(1.6f)); Scene.main.Battle.gameObject.SetActive(true); StartCoroutine(Scene.main.Battle.control(true, trainer, currentEvent.bool0)); while (Scene.main.Battle.gameObject.activeSelf) { yield return(null); } //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f)); yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f))); if (currentEvent.bool0) { if (Scene.main.Battle.victor == 1) { int newTreeIndex = currentEvent.int0; if (newTreeIndex != eventTreeIndex && //only change tree if index is valid newTreeIndex < treesArray.Length) { JumpToTree(newTreeIndex); } } } break; case CustomEventDetails.CustomEventType.ReturnToTitle: UnityEngine.SceneManagement.SceneManager.LoadScene("startup"); break; case CustomEventDetails.CustomEventType.JumpTo: JumpToTree(currentEvent.int0); break; case CustomEventDetails.CustomEventType.MoveCamera: yield return(StartCoroutine(PlayerMovement.player.moveCameraTo(new Vector3(currentEvent.ints[0], currentEvent.ints[1], currentEvent.ints[2]), currentEvent.float0))); break; } }
private void OnItemListSelectionChanged(object sender, SelectionChangedEventArgs e) { int index = listViewItems.SelectedIndex; if (index < mailbox.MailboxCount) { if (index != -1) { selectedIndex = index; } if (selectedIndex != -1 && selectedIndex < mailbox.MailboxCount) { selectedMail = mailbox[selectedIndex]; this.imageMailBackground.Source = ResourceDatabase.GetImageFromName(selectedMail.MailItemData.Name.Replace(" ", "")); this.imageItem.Source = ItemDatabase.GetItemImageFromID(selectedMail.MailItemID); this.imagePokemon.Source = PokemonDatabase.GetPokemonBoxImageFromDexID(selectedMail.OriginalHolderDexID, false); this.labelItemName.Content = (selectedMail.MailItemData != null ? selectedMail.MailItemData.Name : "Unknown Mail"); this.labelPokemon.Content = (selectedMail.OriginalHolderPokemonData != null ? selectedMail.OriginalHolderPokemonData.Name : "Unknown Pokemon"); this.labelTrainerID.Content = selectedMail.TrainerID.ToString("00000"); this.labelSecretID.Content = selectedMail.SecretID.ToString("00000"); MailPositionInfo positions = mailPositions[121]; if (mailPositions.ContainsKey(selectedMail.MailItemID)) { positions = mailPositions[selectedMail.MailItemID]; } int textOffset = 4; Color black = Color.FromRgb(0, 0, 0); Color blackShadow = Color.FromRgb(215, 215, 215); Color white = Color.FromRgb(255, 255, 255); Color whiteShadow = Color.FromRgb(100, 100, 100); this.labelFrom.Margin = new Thickness(positions.FromX - 15, positions.FromY - textOffset, 0, 0); this.labelFrom.Width = positions.FromLength + 30; this.labelFrom.Content = "From " + selectedMail.TrainerName; this.labelFrom.Foreground = new SolidColorBrush(positions.Black ? black : white); (this.labelFrom.Effect as DropShadowEffect).Color = (positions.Black ? blackShadow : whiteShadow); this.stackPanelMessageLines.Margin = new Thickness(positions.MessageX, positions.MessageY - textOffset, 0, 0); string[] lines = selectedMail.Lines; for (int i = 0; i < 5; i++) { (this.stackPanelMessageLines.Children[i] as Label).Content = (i < lines.Length ? lines[i] : ""); (this.stackPanelMessageLines.Children[i] as Label).Foreground = new SolidColorBrush(positions.Black ? black : white); ((this.stackPanelMessageLines.Children[i] as Label).Effect as DropShadowEffect).Color = (positions.Black ? blackShadow : whiteShadow); } this.imagePokemon2.Source = PokemonDatabase.GetPokemonBoxImageFromDexID(selectedMail.OriginalHolderDexID, false); this.imagePokemon2.Margin = new Thickness(positions.PokemonX, positions.PokemonY, 0, 0); this.imagePokemon2.Visibility = (positions.PokemonX == -1 ? Visibility.Hidden : Visibility.Visible); } else { this.imageMailBackground.Source = null; this.imageItem.Source = null; this.imagePokemon.Source = null; this.labelItemName.Content = ""; this.labelPokemon.Content = ""; this.labelTrainerID.Content = ""; this.labelSecretID.Content = ""; this.labelFrom.Content = ""; for (int i = 0; i < 5; i++) { (this.stackPanelMessageLines.Children[i] as Label).Content = ""; } this.imagePokemon2.Visibility = Visibility.Hidden; } } }
private void UpdateUnfoldedEventData(SerializedProperty currentSEvent) { SetEventProps(currentSEvent); /* Draw a line */ GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); EditorGUILayout.PropertyField(eventType_Prop); EditorGUILayout.Space(); CustomEventDetails.CustomEventType ty = (CustomEventDetails.CustomEventType)eventType_Prop.enumValueIndex; switch (ty) { case CustomEventDetails.CustomEventType.Dialog: strings_Prop.arraySize = EditorGUILayout.IntField(new GUIContent("Lines"), strings_Prop.arraySize); EditorGUILayout.Space(); for (int i = 0; i < strings_Prop.arraySize; i++) { strings_Prop.GetArrayElementAtIndex(i).stringValue = EditorGUILayout.TextField(new GUIContent("Dialog " + (i + 1)), strings_Prop.GetArrayElementAtIndex(i).stringValue); } break; case CustomEventDetails.CustomEventType.Choice: strings_Prop.arraySize = EditorGUILayout.IntField(new GUIContent("Choices"), strings_Prop.arraySize); ints_Prop.arraySize = strings_Prop.arraySize; EditorGUILayout.Space(); for (int i = 0; i < strings_Prop.arraySize; i++) { strings_Prop.GetArrayElementAtIndex(i).stringValue = EditorGUILayout.TextField(new GUIContent("Choice " + (i + 1)), strings_Prop.GetArrayElementAtIndex(i).stringValue); ints_Prop.GetArrayElementAtIndex(i).intValue = EditorGUILayout.IntField(new GUIContent("Jump to Tree:"), ints_Prop.GetArrayElementAtIndex(i).intValue); } break; case CustomEventDetails.CustomEventType.Walk: EditorGUILayout.PropertyField(runSimul_Prop, new GUIContent("Run Simultaneously")); EditorGUILayout.Space(); EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Character")); EditorGUILayout.PropertyField(dir_Prop, new GUIContent("Direction")); EditorGUILayout.PropertyField(int0_Prop, new GUIContent("Steps")); EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Lock Direction")); EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Speed Multiplier")); break; case CustomEventDetails.CustomEventType.TurnTo: EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Character")); EditorGUILayout.PropertyField(object1_Prop, new GUIContent("Turn Towards")); int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Direction Mod"), int0_Prop.intValue); break; case CustomEventDetails.CustomEventType.Wait: EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Seconds")); break; case CustomEventDetails.CustomEventType.LogicCheck: CustomEventDetails.Logic lo = (CustomEventDetails.Logic)logic_Prop.enumValueIndex; //Boolean Logic Checks if (lo == CustomEventDetails.Logic.SpaceInParty) { EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("NOT")); } else { EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Check Value:")); } EditorGUILayout.PropertyField(logic_Prop, new GUIContent("Computation")); //CVariable Logic Checks if (lo == CustomEventDetails.Logic.CVariableEquals || lo == CustomEventDetails.Logic.CVariableGreaterThan || lo == CustomEventDetails.Logic.CVariableLessThan) { EditorGUILayout.PropertyField(string0_Prop, new GUIContent("C Variable")); } EditorGUILayout.Space(); EditorGUILayout.PropertyField(int0_Prop, new GUIContent("Jump to Tree:")); break; case CustomEventDetails.CustomEventType.SetCVariable: EditorGUILayout.PropertyField(string0_Prop, new GUIContent("Set Variable:")); EditorGUILayout.PropertyField(float0_Prop, new GUIContent("To Value:")); break; case CustomEventDetails.CustomEventType.Sound: EditorGUILayout.PropertyField(sound_Prop, new GUIContent("Sound")); break; case CustomEventDetails.CustomEventType.SetActive: EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Game Object")); EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Set Active")); break; case CustomEventDetails.CustomEventType.ReceiveItem: EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Is TM")); string0_Prop.stringValue = EditorGUILayout.TextField(new GUIContent("Item"), string0_Prop.stringValue); if (!bool0_Prop.boolValue) { int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Quantity"), int0_Prop.intValue); } break; case CustomEventDetails.CustomEventType.ReceivePokemon: ints_Prop.arraySize = 11; strings_Prop.arraySize = 8; int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Jump To on Fail"), int0_Prop.intValue); EditorGUILayout.Space(); ints_Prop.GetArrayElementAtIndex(0).intValue = EditorGUILayout.IntField(new GUIContent("Pokemon ID"), ints_Prop.GetArrayElementAtIndex(0).intValue); PokemonData pkd = PokemonDatabase.getPokemon(ints_Prop.GetArrayElementAtIndex(0).intValue); string pokemonName = (pkd != null)? pkd.getName() : "null"; EditorGUILayout.LabelField(new GUIContent(" "), new GUIContent(pokemonName)); EditorGUILayout.Space(); strings_Prop.GetArrayElementAtIndex(0).stringValue = EditorGUILayout.TextField(new GUIContent("Nickname"), strings_Prop.GetArrayElementAtIndex(0).stringValue); ints_Prop.GetArrayElementAtIndex(1).intValue = EditorGUILayout.IntSlider(new GUIContent("Level"), ints_Prop.GetArrayElementAtIndex(1).intValue, 1, 100); //Gender if (pkd != null) { if (pkd.getMaleRatio() == -1) { EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Genderless")); } else if (pkd.getMaleRatio() == 0) { EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Female")); } else if (pkd.getMaleRatio() == 100) { EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Male")); } else //if not a set gender { ints_Prop.GetArrayElementAtIndex(2).intValue = EditorGUILayout.Popup(new GUIContent("Gender"), ints_Prop.GetArrayElementAtIndex(2).intValue, new GUIContent[] { new GUIContent("Male"), new GUIContent("Female"), new GUIContent("Calculate") }); } } else { EditorGUILayout.LabelField(new GUIContent("Gender")); } EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Is Shiny")); strings_Prop.GetArrayElementAtIndex(1).stringValue = EditorGUILayout.TextField(new GUIContent("Original Trainer"), strings_Prop.GetArrayElementAtIndex(1).stringValue); strings_Prop.GetArrayElementAtIndex(2).stringValue = EditorGUILayout.TextField(new GUIContent("Poké Ball"), strings_Prop.GetArrayElementAtIndex(2).stringValue); strings_Prop.GetArrayElementAtIndex(3).stringValue = EditorGUILayout.TextField(new GUIContent("Held Item"), strings_Prop.GetArrayElementAtIndex(3).stringValue); //Nature string[] natureNames = NatureDatabase.getNatureNames(); GUIContent[] natures = new GUIContent[natureNames.Length + 1]; natures[0] = new GUIContent("Random"); for (int i = 1; i < natures.Length; i++) { natures[i] = new GUIContent(natureNames[i - 1].Substring(0, 1) + natureNames[i - 1].Substring(1, natureNames[i - 1].Length - 1).ToLower() + "\t | " + NatureDatabase.getNature(i - 1).getUpStat() + "+ | " + NatureDatabase.getNature(i - 1).getDownStat() + "-"); } ints_Prop.GetArrayElementAtIndex(3).intValue = EditorGUILayout.Popup(new GUIContent("Nature"), ints_Prop.GetArrayElementAtIndex(3).intValue, natures); //Ability if (pkd != null) { ints_Prop.GetArrayElementAtIndex(4).intValue = EditorGUILayout.Popup(new GUIContent("Ability"), ints_Prop.GetArrayElementAtIndex(4).intValue, new GUIContent[] { new GUIContent("1: " + pkd.getAbility(0)), new GUIContent("2: " + pkd.getAbility(1)), new GUIContent("(HA) " + pkd.getAbility(2)) }); } else { EditorGUILayout.LabelField(new GUIContent("Ability")); } EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("Custom Moveset"), new GUIContent("(Blanks will be default)")); EditorGUILayout.BeginHorizontal(); strings_Prop.GetArrayElementAtIndex(4).stringValue = EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(4).stringValue); strings_Prop.GetArrayElementAtIndex(5).stringValue = EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(5).stringValue); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); strings_Prop.GetArrayElementAtIndex(6).stringValue = EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(6).stringValue); strings_Prop.GetArrayElementAtIndex(7).stringValue = EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(7).stringValue); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); string IVstring = (bool1_Prop.boolValue)? "Using Custom IVs" : "Using Random IVs"; bool1_Prop.boolValue = EditorGUILayout.Foldout(bool1_Prop.boolValue, new GUIContent(IVstring)); if (bool1_Prop.boolValue) { ints_Prop.GetArrayElementAtIndex(5).intValue = EditorGUILayout.IntSlider(new GUIContent("HP"), ints_Prop.GetArrayElementAtIndex(5).intValue, 0, 31); ints_Prop.GetArrayElementAtIndex(6).intValue = EditorGUILayout.IntSlider(new GUIContent("ATK"), ints_Prop.GetArrayElementAtIndex(6).intValue, 0, 31); ints_Prop.GetArrayElementAtIndex(7).intValue = EditorGUILayout.IntSlider(new GUIContent("DEF"), ints_Prop.GetArrayElementAtIndex(7).intValue, 0, 31); ints_Prop.GetArrayElementAtIndex(8).intValue = EditorGUILayout.IntSlider(new GUIContent("SPA"), ints_Prop.GetArrayElementAtIndex(8).intValue, 0, 31); ints_Prop.GetArrayElementAtIndex(9).intValue = EditorGUILayout.IntSlider(new GUIContent("SPD"), ints_Prop.GetArrayElementAtIndex(9).intValue, 0, 31); ints_Prop.GetArrayElementAtIndex(10).intValue = EditorGUILayout.IntSlider(new GUIContent("SPE"), ints_Prop.GetArrayElementAtIndex(10).intValue, 0, 31); } break; case CustomEventDetails.CustomEventType.TrainerBattle: EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Trainer Script")); EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Loss Allowed?")); if (bool0_Prop.boolValue) { int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Jump To on Loss"), int0_Prop.intValue); } break; } /* Draw a line */ GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); EditorGUILayout.Space(); }
// New pokemon with random IVs and shininess, default moveset and 0 EVs public Pokemon(int pokemonID, Gender gender, int level, Ball caughtBall, string heldItem, string OT, int ability) { PokemonData thisPokemonData = PokemonDatabase.getPokemon(pokemonID); this.pokemonID = pokemonID; this.form = 0; this.gender = gender; if (gender == Gender.CALCULATE) { if (thisPokemonData.getMaleRatio() < 0) { this.gender = Gender.NONE; } else if (Random.Range(0f, 100f) <= thisPokemonData.getMaleRatio()) { this.gender = Gender.MALE; } else { this.gender = Gender.FEMALE; } } this.level = level; this.exp = PokemonDatabase.getLevelExp(level); this.nextLevelExp = PokemonDatabase.getLevelExp(level + 1); this.friendship = thisPokemonData.getBaseFriendship(); this.isShiny = (Random.Range(0, 65536) < 16); this.status = Status.NONE; this.sleepTurns = 0; this.caughtBall = caughtBall; this.heldItem = heldItem; this.OT = (string.IsNullOrEmpty(OT) ? "Unknown" : OT); this.metLevel = level; this.metMap = "Somewhere"; this.metDate = System.DateTime.Today.Day + "/" + System.DateTime.Today.Month + "/" + System.DateTime.Today.Year; this.IV_HP = Random.Range(0, 32); this.IV_ATK = Random.Range(0, 32); this.IV_DEF = Random.Range(0, 32); this.IV_SPA = Random.Range(0, 32); this.IV_SPD = Random.Range(0, 32); this.IV_SPE = Random.Range(0, 32); this.EV_HP = 0; this.EV_ATK = 0; this.EV_DEF = 0; this.EV_SPA = 0; this.EV_SPD = 0; this.EV_SPE = 0; this.nature = NatureDatabase.getRandomNature().getName(); this.calculateStats(); this.currentHP = HP; if (ability < 0 || ability > 2) { this.ability = Random.Range(0, 2); } else { this.ability = ability; } this.moveset = thisPokemonData.generateMoveset(this.level); this.moveHistory = moveset; this.PPups = new int[4]; this.maxPP = new int[4]; this.PP = new int[4]; for (int i = 0; i < 4; i++) { if (!string.IsNullOrEmpty(moveset[i])) { this.maxPP[i] = MoveDatabase.getMove(this.moveset[i]).getPP(); this.PP[i] = this.maxPP[i]; } } packMoveset(); }
private void GeneratePID(GBAPokemon pkm, Random random) { PokemonData pokemonData = PokemonDatabase.GetPokemonFromDexID(DexID); byte genderByte = pokemonData.GenderRatio; BitArray bitsID = ByteHelper.GetBits((ushort)(pkm.TrainerID ^ pkm.SecretID)); BitArray bitsPID1 = new BitArray(16); BitArray bitsPID2 = new BitArray(16); uint pid = 0; int tryCount = 0; while (true) { if (IsShiny.HasValue && !IsEgg) { if (IsShiny.Value) { for (int i = 0; i < 3; i++) { bitsPID1[i] = random.Next(2) == 1; bitsPID2[i] = random.Next(2) == 1; } for (int i = 3; i < 16; i++) { bool bit = random.Next(2) == 1; bitsPID1[i] = (bitsID[i] ? !bit : bit); bitsPID2[i] = bit; } pid = 0; pid = ByteHelper.SetBits(pid, 16, bitsPID1); pid = ByteHelper.SetBits(pid, 0, bitsPID2); pkm.Personality = pid; } else { // The chances of this are astronamically low so we can be lazy and not use an algorithm while (pkm.IsShiny) { pkm.Personality = (uint)random.Next(); } } } else { pkm.Personality = (uint)random.Next(); } if ((!Gender.HasValue || pkm.Gender == Gender || genderByte == 255 || genderByte == 254 || genderByte == 0) && (!NatureID.HasValue || pkm.NatureID == NatureID)) { break; } tryCount++; // Let's give up (I haven't done the math to see if it's always possible to get all 3 combinations. Plus RNG is a bitch so... we need a failsafe) if (tryCount > 5000) { break; } } }
public HackedPokemonController(PokemonDatabase database) { this.database = database; }