public void modifyRole() { RoleOverride ro = getRoleOverride(); if (ro != null) { if (!Object.ReferenceEquals(ro.role, null)) { this.role = ro.role; } if (!Object.ReferenceEquals(ro.deftype, null)) { this.deftype = ro.deftype; } if (!Object.ReferenceEquals(ro.statspread, null)) { this.statSpread = ro.statspread; } if (!Object.ReferenceEquals(ro.item, null)) { this.item = ro.item; } this.certainAbility = ro.certainAbility; } }
private void basicInit(PokeJSONObj obj) { types = Global.types; name = obj.species.ToLower(); type1 = types[obj.types[0].ToLower()]; if (obj.types.Count < 2) { type2 = type1; } else { type2 = types[obj.types[1].ToLower()]; } stats = obj.baseStats; setAbilities(obj.abilities); weight = (float)obj.weightkg; deftype = new DefenseType(); role = new Role(); realStats = new Dictionary <string, int>(); }
/// <summary> /// Returns a number between 0,1 that determines /// the likelihood of this mon KOing the enemy /// </summary> /// <param name="enemy"></param> /// <returns></returns> public float checkKOChance(BattlePokemon enemy) { float chance = 0; //First check if we are faster. if (this.getStat("spe") > enemy.getStat("spe")) { chance += 0.1f; } //Now check if we are a suitable attacker Role role = mon.getRole(); DefenseType edeftype = enemy.mon.getDefType(); if (((role.physical) && (edeftype.special)) || ((role.special) && (edeftype.physical)) || (edeftype.any)) { chance += 0.4f; } if (enemy.getHPPercentage() < 50) { chance += 0.2f; } else { chance -= 0.1f; } if (checkTypes(enemy) >= 2.5f) { chance += 0.2f; } //Todo: add other parameters here. Decrement chance for unsuitable matchings, etc. //Todo also: adjust chance scale. do some calcs to find out what produces more favorable results. return(chance); }
private void basicInit(PokeJSONObj obj) { types = Global.types; name = obj.species.ToLower(); type1 = types[obj.types[0].ToLower()]; if (obj.types.Count < 2) type2 = type1; else type2 = types[obj.types[1].ToLower()]; stats = obj.baseStats; abilities = obj.abilities; weight = (float)obj.weightkg; deftype = new DefenseType(); role = new Role(); realStats = new Dictionary<string, int>(); }
public void modifyRole() { RoleOverride ro = getRoleOverride(); if (ro != null) { if (!Object.ReferenceEquals(ro.role, null)) this.role = ro.role; if (!Object.ReferenceEquals(ro.deftype, null)) this.deftype = ro.deftype; if (!Object.ReferenceEquals(ro.statspread, null)) this.statSpread = ro.statspread; if (!Object.ReferenceEquals(ro.item, null)) this.item = ro.item; } }