public static string determineStat(PokeType attackType) { /* * Normal = 0, // Uses Strength Modifier * Psychic = 1, // Uses Intelligence Modifier * Fighter = 2, // Uses Strength Modifier * Fire = 3, // Uses Wisdom Modifier * Water = 4, // Uses Intelligence Modifier * Grass = 5 // Uses Dexterity */ switch (attackType) { case PokeType.Normal: return("Strength"); case PokeType.Psychic: return("Intelligence"); case PokeType.Fighter: return("Strength"); case PokeType.Fire: return("Wisdom"); case PokeType.Water: return("Intelligence"); case PokeType.Grass: return("Dexterity"); default: return("Strength"); } }
PokeType convertPokeTypeFromString(string typeName) { PokeType pokeType = PokeType.normal; switch (typeName) { case "dark": pokeType = PokeType.dark; break; case "flying": pokeType = PokeType.flying; break; case "water": pokeType = PokeType.water; break; case "ground": pokeType = PokeType.ground; break; case "fire": pokeType = PokeType.fire; break; case "ice": pokeType = PokeType.ice; break; } return(pokeType); }
public Pokemon(int number, string name, int level, PokeType t1, PokeType t2, string[] m, int hp, int currentHP, int atk, int def, int satk, int sdef, int sped, int catchRate) { ID = Guid.NewGuid(); Number = number; Name = name; this.level = level; TypeOne = t1; TypeTwo = t2; Moves = m; HP = hp; Attack = atk; Defense = def; SpAtk = satk; SpDef = sdef; Speed = sped; if (currentHP < 0) { currentHP = HP; } else { CurrentHP = currentHP; } this.captureRate = catchRate; Status = StatusType.Null; MovesOnLevel = new Dictionary <int, string>(); }
public async Task <IActionResult> Create([Bind("Id,Name,Image,ImageFileName")] PokeType pokeType, IFormFile imageUpload) { if (ModelState.IsValid) { _context.Add(pokeType); await _context.SaveChangesAsync(); var fileExtension = Path.GetExtension(imageUpload.FileName); var filePath = Url.Content("wwwroot/uploads/images/types/" + pokeType.Name + fileExtension); if (imageUpload.Length > 0) { using (var stream = new FileStream(filePath, FileMode.Create)) { await imageUpload.CopyToAsync(stream); pokeType.ImageFileName = pokeType.Name + fileExtension; } } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pokeType)); }
public static MessageChainBuilder AddPoke(this MessageChainBuilder builder, PokeType type) { Poke poke = new Poke(type); builder.Add(poke); return(builder); }
public Pokemon(PokeSpecies psSpecies, int iLevel) { this.psSpecies = psSpecies; ptType = dictPokemonTypes[psSpecies]; sNickName = psSpecies.ToString().ToUpper(); this.iLevel = iLevel; if (iLevel < 1) { this.iLevel = 1; } else if (iLevel > iLevelCap) { this.iLevel = iLevelCap; } iCurrentHealth = iMaxHealth = getHealthStat(); iAttackStat = getAttackStat(); iDefenseStat = getDefenseStat(); iSpeedStat = getSpeedStat(); iExperience = dictPokemonStats[psSpecies][(this.iLevel - 1)][PokeStat.Experience]; }
/* * modifyHealth(value : int, isSuperEffective : bool) : void * * modifyHealth(...) is responsible for modifying the current HP of THIS Pokemon. * Additionally, if there is an attack/heal that is considered to be "super effective," * it will adjust the value receieved according * to a constant percentage of this Pokemon's max HP. * * value : int >> flat, constant value to adjust the current HP * isSuperEffective : bool >> true -- add additional damage/healing, false -- use only the flat damage/healing receieved * * Return : void */ public void modifyHealth(int value, PokeType attackerType) { double percentOfMaxHP = 0.1; bool isSuperEffective = determineIsSuperEffective(attackerType); if (isSuperEffective) //if something is supereffective, it implies that damage is being dealt -- so, we should subtract our proportion { value = (int)(value - (int)Math.Floor(percentOfMaxHP * stats["MaxHP"])); //If a move against THIS pokemon is 'super effective', tack on additional damage equal to 15% (adjust as needed) of the Pokemon's max health } // If the value is NEGATIVE, it's considered DAMAGE. If the value is POSITIVE, its considered HEALING // First determine if value being added is greater > maxHP: if (this.stats["HP"] + value > this.stats["MaxHP"]) { this.stats["HP"] = this.stats["MaxHP"]; } else if (this.stats["HP"] + value < 0) { this.stats["HP"] = 0; } else { Debug.Log(this.name + " -- def mod. : " + (value * this.defenseModifier)); Debug.Log(this.name + " took " + value + " points of damage!"); this.stats["HP"] += value; } }
public double Multiplier(PokeType target) { switch (target.Name) { case "FIRE": return(0.5); case "GRASS": return(2); case "FIGHTING": return(0.5); case "POISON": return(0.5); case "FLYING": return(0.5); case "GHOST": return(0.5); case "PSYCHIC": return(2); case "ROCK": return(0.5); case "FAIRY": return(0.5); case "DARK": return(2); case "STEEL": return(0.5); default: return(1); } }
public Pokemon(ushort dexNumber, string name, string description, string category, PokeType type1, PokeType type2, List <Ability> abilities, Stats baseStats, double height, double weight, GenderRatio genderRatio, string evolveToName, EvolveAction evolveToAction, bool isLegendary = false) { DexNumber = dexNumber; Name = name.Substring(0, 1).ToUpper() + name.Substring(1).ToLower(); Description = description; Category = category.ToUpper(); Type1 = type1; Type2 = type2; Abilities = abilities; BaseStats = baseStats; Height = (int)(height * 100) / 100.0; Weight = (int)(weight * 100) / 100.0; GenderRatio = genderRatio; IsLegendary = isLegendary; if (evolveToName != "") { EvolveTo = new Pokemon(0, evolveToName, "", "", PokeType.NONE, PokeType.NONE, null, null, 0, 0, null, "", null, false); EvolveToAction = evolveToAction; EvolveTo.EvolveFrom = this; EvolveTo.EvolveFromAction = this.EvolveToAction; } ImageSource = "ms-appx:///Assets/Gen I Pics/" + DexNumber.ToString("000") + Name + ".png"; }
public bool HasDisadvantage(int index, bool defending) { PokeType defType = towersP2[index].GetComponent <PokeTowerScript>().GetPokeType(); PokeType attType = towersP1[index].GetComponent <PokeTowerScript>().GetPokeType(); int damage = 2; if (defending) { damage = transform.GetComponent <ConstDataScript>().CountDamage(attType, defType); if (damage > transform.GetComponent <ConstDataScript>().GetBaseDamage() * 2) { return(true); } return(false); } else { damage = transform.GetComponent <ConstDataScript>().CountDamage(defType, attType); if (damage > transform.GetComponent <ConstDataScript>().GetBaseDamage() * 2) { return(true); } return(false); } }
public Pokemon(int number, string name, PokeType type1, PokeType type2, int[] baseStats) { _number = number; _name = name; _type1 = type1; _type2 = type2; _baseStats = baseStats; }
/* * determineIsSuperEffective(attackerType : PokeType) : bool * * Determines if the attacking pokemon type is this pokemon's weakness * * attackerType : PokeType >> Type of the attacking Pokemon * * Return : bool >> Returns true if the attacking type counters this Pokemon's type. */ private bool determineIsSuperEffective(PokeType attackerType) { if (attackerType == this.weaknessPokeType) { return(true); } return(false); }
private int GetDamage(PokeType usertype, PokeType targetType) { var rng = new Random(); int damage = rng.Next(40, 60); var multiplier = usertype.Multiplier(targetType); damage = (int)(damage * multiplier); return(damage); }
/// <summary> /// Removes unique pokemon type from list if the pokemon type is in the list. /// If the pokemon type is removed succesfully, the pokemon's 'TypeChanged' event will be called. /// </summary> /// <param name="item"> Unique pokemon type to remove. </param> /// <returns> True if the pokemon type is removed successfully, false otherwise. </returns> public bool Remove(PokeType item) { if (!list.Remove(item)) { return(false); } pokemon.Events.TypeChanged(); return(true); }
public Attack(string name, PokeType attackType, Condition cdn, DamageThreshold threshold, int PP, bool hasDebuff = false, bool hasDamage = false) { this.name = name; this.attackType = attackType; this.condition = cdn; this.threshold = threshold; this.PP = PP; this.hasDebuff = hasDebuff; this.hasDamage = hasDamage; }
/// <summary> /// Adds a pokemon type to the list if the pokemon type is not in it already. /// If pokemon type is added succesfully, the pokemon's 'TypeChanged' event will be called. /// </summary> /// <param name="item"> Unique pokemon type to add. </param> /// <returns> True if pokemon type is added successfully (is unique), false otherwise. </returns> public bool Add(PokeType item) { if (list.Contains(item)) { return(false); } list.Add(item); pokemon.Events.TypeChanged(); return(true); }
public void CorrectResponceToValidType() { var pokedexViewModel = new PokedexViewModel(mockPokeRegistry.Object, pokeTypeConstants, mockPdfService.Object, mockExcelService.Object); var validPokeType = new PokeType("fire"); mockExcelService.Setup(e => e.getStoredFilter()).Returns((string.Empty, validPokeType)); pokedexViewModel.LoadFilter.Execute(); pokedexViewModel.PokeTypeErrorVisibility.Should().Be(Visibility.Visible); }
/// <summary> /// Inserts pokemon type into specified index if the pokemon type is unique. /// Items on and past this index will be pushed one index up. </summary> /// If successful, the pokemon's 'TypeChanged' event will be called. /// <param name="index"> Index to insert into. </param> /// <param name="item"> Pokemon type to insert. </param> /// <returns> True if inserted successfully, false otherwise. </returns> public bool Insert(int index, PokeType item) { if (list.Contains(item)) { return(false); } list.Insert(index, item); pokemon.Events.TypeChanged(); return(true); }
public Pokemon(string name, PokeType pokeType, List <AbstractCapacity> comps, int hp) { Name = name; PokeType = pokeType; Comps = comps; Hp = hp; AlterationStatus = new List <AlterationStatus>(); Comps = comps; HpMax = hp; }
public Move(string _moveName, int _atktype, PokeType _type, int _power, int _accuracy, int _cpp, int _mpp) { moveName = _moveName; moveType = _atktype; type = _type; power = _power; accuracy = _accuracy; currentPP = _cpp; maxPP = _mpp; }
async void OnItemSelected(object sender, EventArgs e) { BindableObject layout = (BindableObject)sender; PokeType pokeType = (PokeType)layout.BindingContext; await pokeType.LoadStrengths(); TypeDetailViewModel typeDetailViewModel = new TypeDetailViewModel(pokeType); await Navigation.PushAsync(new TypeDetailPage(typeDetailViewModel)); }
public string GetTypePictureSource(int typeNum) { if (typeNum < 1 || typeNum > 2) { throw new IndexOutOfRangeException("You can only select either type 1 or type 2"); } PokeType type = typeNum == 1 ? Type1 : Type2; return("ms-appx:///Assets/Types/" + type.ToString().Substring(0, 1).ToUpper() + type.ToString().Substring(1).ToLower() + ".png"); }
/// <summary> Adds type to modifer dictionary unless it is already present. </summary> /// <param name="mod"> Modifier dictionary. </param> /// <param name="type"> Type key to add. </param> /// <param name="value"> Value to corropond with type key. </param> private void AddType(Dictionary <PokeType, float> mod, PokeType type, float value) { if (!mod.ContainsKey(type)) { mod.Add(type, value); } else { Debug.LogError(type + " appears more than once in " + name + "!"); } }
public HiddenPowerTypeCriteria(params PokeType[] pokeTypes) { var t = PokeType.Non; foreach (var type in pokeTypes) { t |= type; } targetType = t; }
private void readValuesFromFilterFile() { pokeNameFilter = string.Empty; pokeTypeFilter = new PokeType("none"); using (var filterPackage = new ExcelPackage(filterFileInfo)) { var worksheet = filterPackage.Workbook.Worksheets[0]; pokeNameFilter = worksheet.Cells["B1"].Value.ToString(); pokeTypeFilter = new PokeType(worksheet.Cells["B2"].Value.ToString()); } }
async void OnItemSelected(object sender, EventArgs e) { BindableObject layout = (BindableObject)sender; PokeType pokeType = (PokeType)layout.BindingContext; await pokeType.LoadStrengths(); Page previousPage = Navigation.NavigationStack.Last(); await Navigation.PushAsync(new TypeDetailPage(new TypeDetailViewModel(pokeType))); Navigation.RemovePage(previousPage); }
public PokeType[] GetWeaknesses(PokeType pokeType) { for (int i = 0; i < TypeParameters.Length; i++) { if (TypeParameters[i].BaseType == pokeType) { return(TypeParameters[i].WeaknessesTypes); } } return(null); }
public PokeType[] GetStrenghts(PokeType pokeType) { for (int i = 0; i < TypeParameters.Length; i++) { if (TypeParameters[i].BaseType == pokeType) { return(TypeParameters[i].StrenghtsTypes); } } return(null); }
private PokeType generateType(int typeIndex) { int typesCount = System.Enum.GetNames(typeof(PokeType)).Length; int newIndex = Random.Range(0, typesCount); while (newIndex == typeIndex) { newIndex = Random.Range(0, typesCount); } PokeType pT = gM.GetComponent <ConstDataScript>().GetType(newIndex); return(pT); }
public double Multiplier(PokeType target) { switch (target.Name) { case "DRAGON": return(2); case "STEEL": return(0.5); case "FAIRY": return(0); default: return(1); } }
public double Multiplier(PokeType target) { switch (target.Name) { case "ROCK": return(0.5); case "GHOST": return(0); case "STEEL": return(0.5); default: return(1); } }
/* 🌿 or 🍃 or 🌱 Grass ⚡ Electric ❄ Ice ☁ Fly 🔥 Fire 💧 or 💦 Water ⭕ Normal 🐛 Insect 🌟 or 💫 or ✨ Fairy */ string GetImage(PokeType t) { switch (t) { case PokeType.WATER: return "💦"; case PokeType.GRASS: return "🌿"; case PokeType.FIRE: return "🔥"; case PokeType.ELECTRICAL: return "⚡️"; default: return "⭕️"; } }
private int GetDamage(PokeType targetType, string v) { var rng = new Random(); switch (v) { case "splash": //water if (targetType == PokeType.FIRE) return rng.Next(65, 100); else if (targetType == PokeType.ELECTRICAL) return rng.Next(0, 35); else return rng.Next(40, 60); case "strike": //grass if (targetType == PokeType.ELECTRICAL) return rng.Next(65, 100); else if (targetType == PokeType.FIRE) return rng.Next(0, 35); else return rng.Next(40, 60); case "burn": //fire case "flame": if (targetType == PokeType.GRASS) return rng.Next(65, 100); else if (targetType == PokeType.WATER) return rng.Next(0, 35); else return rng.Next(40, 60); case "surge": //electrical case "electrocute": if (targetType == PokeType.WATER) return rng.Next(65, 100); else if (targetType == PokeType.GRASS) return rng.Next(0, 35); else return rng.Next(40, 60); default: return 0; } }