public static void FillAttackList() { DataRowCollection attackDataRows = StaticSQL.GetAttacks().Rows; foreach (DataRow attackRow in attackDataRows) { var values = attackRow.ItemArray; IAttack attack = PokemonAttacksFactory.CreateAttack(); attack.ID = (int)values[0]; attack.Name = (string)values[1]; attack.Power = values[2] != DBNull.Value ? (int?)values[2] : null; attack.Accuracy = (int)values[3]; attack.BoostStats = values[4] != DBNull.Value ? (string)values[4] : ""; attack.ElementalType = values[5] != DBNull.Value ? (ElementalType)values[5] : 0; attack.IsSpecial = (bool)values[6]; attack.AdditionalEffects = AdditionalEffectFactory.GetAdditionalEffects(values[7] != DBNull.Value ? (string)values[7] : ""); Attacks.Add(attack.ID, attack); } }
public bool IsAbleToAttack() { if (IsFlinched) { IsFlinched = false; //_battleLogController.SetText($"{attackingPokemon.Name} is flinched"); return(false); } if (IsConfused && BattleHelper.HasFailedConfusion(this)) { var confusionHit = PokemonAttacksFactory.CreateAttack("ConfusionHit"); int damage = DamageCalculator.CalculateAttackDamage(confusionHit, this, this); Hurt(damage); //_battleLogController.SetText($"{attackingPokemon.Name} hurts itself in its confusion"); return(IsPokemonAlive()); } return(true); }