public int[] ppBoosts; //0, 1, 2 or 3 public PokemonSet(string speciesId = "", string name = "", int level = 100, Globals.GenderName gender = Globals.GenderName.F, int happiness = 0, string pokeball = "", bool shiny = false, string abilityId = "", string itemId = "", string[] movesId = null, Globals.StatsTable evs = null, Globals.StatsTable ivs = null, Globals.Nature nature = null, int[] ppBoosts = null) { this.speciesId = speciesId; this.name = name; this.level = level; this.gender = gender; this.happiness = happiness; this.pokeball = pokeball; this.shiny = shiny; this.abilityId = abilityId; this.itemId = itemId; this.movesId = movesId; if (evs == null) { evs = new Globals.StatsTable(); } this.evs = evs; if (ivs == null) { ivs = new Globals.StatsTable(); ivs.StatsTableIvs(); } this.ivs = ivs; if (nature == null) { nature = new Globals.Nature(name: "basic"); } this.nature = nature; if (movesId != null && (ppBoosts == null || ppBoosts.Length < movesId.Length)) { this.ppBoosts = new int[movesId.Length]; for (int i = 0; i < movesId.Length; ++i) { if (ppBoosts == null || ppBoosts.Length <= i) { this.ppBoosts[i] = 0; } else { this.ppBoosts[i] = ppBoosts[i]; } } } else { this.ppBoosts = ppBoosts; } }
public TemplateData( /*Required*/ string ability0, Globals.StatsTable baseStats, string color, Globals.EggGroups eggGroups, float heightm, int num, string species, Globals.Type[] types, float weightkg, /*Optional*/ string ability1 = "", string abilityH = "", string abilityS = "", string baseForme = "", string baseSpecies = "", int evoLevel = -1, string evoMove = "", string[] evos = null, string forme = "", /*Optional*/ string formeLetter = "", Globals.GenderName gender = Globals.GenderName.MorF, float maleGenderRatio = 0, float femaleGenderRatio = 0, int maxHP = -1, string[] otherForms = null, string[] otherFormes = null, /*Optional*/ string prevo = "", bool isMega = false, string requiredMove = "", string requiredItem = "", bool isUltra = false ) { /*Required*/ this.ability0 = ability0; this.baseStats = baseStats; this.color = color; this.eggGroups = eggGroups; this.heightm = heightm; this.num = num; this.species = species; this.types = types; this.weightkg = weightkg; /*Optional*/ this.ability1 = ability1; this.abilityH = abilityH; this.abilityS = abilityS; this.baseForme = baseForme; this.baseSpecies = (baseSpecies == "") ? species : baseSpecies; this.evoLevel = evoLevel; this.evoMove = evoMove; this.evos = evos; this.forme = forme; this.formeLetter = formeLetter; this.gender = gender; this.maleGenderRatio = maleGenderRatio; this.femaleGenderRatio = femaleGenderRatio; this.maxHP = maxHP; this.otherForms = otherForms; this.otherFormes = otherFormes; this.prevo = prevo; this.isMega = isMega; this.requiredMove = requiredMove; this.requiredItem = requiredItem; this.isUltra = isUltra; //logged until here }
public HiddenPower(Globals.StatsTable ivs) { Globals.Type[] hpTypes = new Globals.Type[] { Globals.Type.Fighting, Globals.Type.Flying, Globals.Type.Poison, Globals.Type.Ground, Globals.Type.Rock, Globals.Type.Bug, Globals.Type.Ghost, Globals.Type.Steel, Globals.Type.Fire, Globals.Type.Water, Globals.Type.Grass, Globals.Type.Electric, Globals.Type.Psychic, Globals.Type.Ice, Globals.Type.Dragon, Globals.Type.Dark }; int hpTypeX = 0; //int hpPowerX = 0; int i = 1; hpTypeX += i * (ivs.hp % 2); //hpPowerX += i * (ivs.hp/2) %2; i *= 2; hpTypeX += i * (ivs.atk % 2); //hpPowerX += i * (ivs.atk / 2) % 2; i *= 2; hpTypeX += i * (ivs.def % 2); //hpPowerX += i * (ivs.def / 2) % 2; i *= 2; hpTypeX += i * (ivs.spe % 2); //hpPowerX += i * (ivs.spe / 2) % 2; i *= 2; hpTypeX += i * (ivs.spa % 2); //hpPowerX += i * (ivs.spa / 2) % 2; i *= 2; hpTypeX += i * (ivs.spd % 2); //hpPowerX += i * (ivs.spd / 2) % 2; hpType = hpTypes[(hpTypeX * 15 / 63)]; //hpPower = (hpPowerX * 40 / 63) + 30; hpPower = 60; }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Z)) { //TYPECHART int value = TypeChart.BattleTypeChart["" + typeDefense].damageTaken["" + typeAttack]; string result = (value == 0) ? " is ok against " : (value == 1) ? " is super effective against " : (value == 2) ? "is not very effective against " : (value == 3) ? " does not affect " : "wat"; Debug.Log(typeAttack + result + typeDefense); } if (Input.GetKeyDown(KeyCode.X)) { //LOG TEMPLATEDATA LogPokemon(); } if (Input.GetKeyDown(KeyCode.C)) { //BOOSTMODIFIERS STUFF int previousMod = 6144; int nextMod = 5325; int nextValue = (previousMod * nextMod + 2048); int test = nextValue >> 12; float end = (float)test / 4096f; float wat = (6144f / 4096f) * (5325f / 4096f); Debug.Log("((previousMod * nextMod + 2048) >> 12) / 4096 \n" + "((" + previousMod + "*" + nextMod + "+ 2048) >> 12) / 4096 \n" + "((" + previousMod + " * " + nextMod + " + 2048) = " + nextValue + "\n" + nextValue + " >> 12 = " + test + "\n" + test + " / 4096 = " + end ); Debug.Log("" + 6144f / 4096f + " * " + 5325f / 4096f + " = " + wat); } if (Input.GetKeyDown(KeyCode.V)) { //LOG BATTLE STATS Globals.StatsTable baseStats = new Globals.StatsTable(hp: 45, atk: 49, def: 49, spa: 65, spd: 65, spe: 45); Globals.StatsTable stats = baseStats.ShallowCopy();// new Globals.StatsTable(hp: 45, atk: 49, def: 49, spa: 65, spd: 65, spe: 45); PokemonSet set = new PokemonSet(); set.ivs = new Globals.StatsTable(); set.evs = new Globals.StatsTable(); set.level = 50; set.nature = new Globals.Nature("Testing");//, plus: "hp", minus: "spe"); stats.SetBattleStats(set); Debug.Log("Testing Stats: hp: " + stats.hp + ", atk:" + stats.atk + ", def:" + stats.def + ", spa:" + stats.spa + ", spd:" + stats.spd + ", spe:" + stats.spe); Debug.Log("Base stats used: hp: " + baseStats.hp + ", atk:" + baseStats.atk + ", def:" + baseStats.def + ", spa:" + baseStats.spa + ", spd:" + baseStats.spd + ", spe:" + baseStats.spe); } if (Input.GetKeyDown(KeyCode.B)) { //LOG HIDDEN POWER Globals.HiddenPower hp = new Globals.HiddenPower(hpIvs); Debug.Log("Hidden Power: " + hp.hpType + " " + hp.hpPower); } if (Input.GetKeyDown(KeyCode.N)) { //LOG CAN MEGA EVOLVE TemplateData templateData = Pokedex.BattlePokedex["rayquaza"]; PokemonSet set = new PokemonSet(); set.itemId = "abomasite"; set.movesId = new string[] { "tackle" }; Debug.Log("Can mega evolve " + CanMegaEvolve(templateData, set)); } if (Input.GetKeyDown(KeyCode.M)) { //LOG CAN ULTRA BURST TemplateData templateData = Pokedex.BattlePokedex["necrozmadawnwings"]; PokemonSet set = new PokemonSet(); set.itemId = "ultranecroziumz"; set.movesId = new string[] { "tackle" }; Debug.Log("Can ultra burst " + CanUltraBurst(templateData, set)); } if (Input.GetKeyDown(KeyCode.A)) { //LOG POKEMON DATA Battle battle = new Battle(); PokemonSet set = new PokemonSet( speciesId: "bulbasaur", name: "Flamenco", level: 50, gender: Globals.GenderName.M, happiness: 100, pokeball: "MajoBall", shiny: false, abilityId: "overgrow", itemId: "normaliumz", movesId: new string[] { "tackle", "absorb", "caca", "10000000voltthunderbolt" }, evs: new Globals.StatsTable(spd: 252, def: 252, spe: 6), ivs: BestHiddenPowers.HiddenPowers["Ice"], nature: Natures.BattleNatures["adamant"], ppBoosts: new int[] { 3, 1, 0, 2 } ); Pokemon testPoke = new Pokemon(battle, set, new Battle.Team(new PokemonSet[] { set }), null); testPoke.LogPokemon(); } if (Input.GetKeyDown(KeyCode.S)) { //TESTING CALLBACK GETTERS AND CALLERS MoveData move = Moves.BattleMovedex["test"]; Debug.Log(move.id); Debug.Log(move.eventMethods.HasCallback("onModifyAtk")); Debug.Log(move.eventMethods.HasCallback("onTakeItem")); Debug.Log(move.eventMethods.HasCallback("caca")); Debug.Log(move.eventMethods.HasCallback("id")); Battle.RelayVar relayVar = new Battle.RelayVar(); Debug.Log("I was a " + relayVar.integerValue + " before"); move.eventMethods.StartCallback("onModifyAtk", null, relayVar, null, null, null); Debug.Log("But now, thanks to the StartCallback method, I am a " + relayVar.integerValue); } if (Input.GetKeyDown(KeyCode.D)) { //Single event test Battle b = new Battle(); MoveData move = Moves.BattleMovedex["test"]; Battle.RelayVar tororo = b.SingleEvent("ModifyAtk", move); Debug.Log(tororo.integerValue); } if (Input.GetKeyDown(KeyCode.F)) { } if (Input.GetKeyDown(KeyCode.Q)) { Battle b = new Battle(); PokemonSet set1 = new PokemonSet(speciesId: "bulbasaur", name: "Tentomon", level: 50, gender: Globals.GenderName.F, abilityId: "testingrunevent", itemId: "testingrunevent", movesId: new string[] { "testingrunevent" }); Battle.Team t1 = new Battle.Team(new PokemonSet[] { set1 }); GameObject go1 = new GameObject(); PokemonCharacter pc1 = go1.AddComponent <PokemonCharacter>(); pc1.Init(b, set1, t1); pc1.pokemonData.isActive = true; t1.pokemons = new PokemonCharacter[] { pc1 }; t1.teamMoves = new List <ActiveMove>(); PokemonSet set2 = new PokemonSet(speciesId: "bulbasaur", name: "Tentomon", level: 50, gender: Globals.GenderName.F, abilityId: "testingrunevent", itemId: "testingrunevent", movesId: new string[] { "testingrunevent" }); Battle.Team t2 = new Battle.Team(new PokemonSet[] { set2 }); GameObject go2 = new GameObject(); PokemonCharacter pc2 = go2.AddComponent <PokemonCharacter>(); pc2.Init(b, set2, t2); pc2.pokemonData.isActive = true; t2.pokemons = new PokemonCharacter[] { pc2 }; t2.teamMoves = new List <ActiveMove>(); b.teams = new Battle.Team[] { t1, t2 }; MoveData move = Moves.BattleMovedex["testingrunevent"]; Battle.RelayVar relayVar = new Battle.RelayVar(integerValue: move.basePower); relayVar = b.RunEvent("BasePower", pc1.targetScript, pc2, move, relayVar, true); Debug.Log(relayVar.integerValue); //public int GetDamage(Pokemon pokemon, Pokemon target, ActiveMove activeMove, int directDamage = -1)//movedata comes from active move?? //DirectDamage for confusion and stuff GameObject go3 = new GameObject(); ActiveMove am = go3.AddComponent <ActiveMove>(); am.activeData = new ActiveMove.ActiveMoveData(move.id); int damage = b.GetDamage(pc1.pokemonData, pc2.pokemonData, am); Debug.Log("Damage " + damage); } }