public void Create(TypeAdvantage typeAdvantage) { using (var conn = NewConnection) { conn.Execute(Scripts.CreateTypeAdvantageSql, typeAdvantage); } }
public static TypeAdvantageDto ToDto(this TypeAdvantage typeAdvantage) { return(new TypeAdvantageDto() { AttackingType = typeAdvantage.AttackingType, DefendingType = typeAdvantage.DefendingType, Effect = typeAdvantage.Effect }); }
public override int CalculateDamageToDeal(float attackDefenseRatio, float modifiersValue, PokemonInstance user, PokemonInstance target, BattleData battleData) { if (TypeAdvantage.CalculateMultiplier(type, target.species) == 0) { return(0); } else { return(user.GetLevel()); } }
private float[] GetMoveWeightings(PokemonInstance opposingPokemon) { float[] weightings = new float[ActivePokemon.moveIds.Length]; if (ActivePokemon.battleProperties.volatileStatusConditions.encoreTurns > 0) { weightings = GetEncoreMoveWeightings(); } else { for (int i = 0; i < ActivePokemon.moveIds.Length; i++) { weightings[i] = 1; //Move unset if (PokemonMove.MoveIdIsUnset(ActivePokemon.moveIds[i])) { weightings[i] = 0; continue; } //Out of PP if (ActivePokemon.movePPs[i] <= 0) { weightings[i] = 0; } PokemonMove move = PokemonMove.GetPokemonMoveById(ActivePokemon.moveIds[i]); //Being taunted if (ActivePokemon.battleProperties.volatileStatusConditions.tauntTurns > 0 && move.moveType == PokemonMove.MoveType.Status) { weightings[i] = 0; } //Being tormented if (ActivePokemon.battleProperties.volatileStatusConditions.torment && ActivePokemon.battleProperties.lastMoveId == move.id) { weightings[i] = 0; } //Type advantage weightings[i] *= GetTypeAdvantageWeighting(TypeAdvantage.CalculateMultiplier(move.type, opposingPokemon.species)); } } return(weightings); }
protected float[] GetMoveWeightings(PokemonInstance target) { float[] weightings = new float[4] { 1, 1, 1, 1 }; if (ActivePokemon.battleProperties.volatileStatusConditions.encoreTurns > 0) { weightings = GetEncoreMoveWeightings(); } else { for (int i = 0; i < ActivePokemon.moveIds.Length; i++) { //Move unset if (PokemonMove.MoveIdIsUnset(ActivePokemon.moveIds[i])) { weightings[i] = 0; continue; } PokemonMove move = PokemonMove.GetPokemonMoveById(ActivePokemon.moveIds[i]); //Being taunted if (ActivePokemon.battleProperties.volatileStatusConditions.tauntTurns > 0 && move.moveType == PokemonMove.MoveType.Status) { weightings[i] = 0; } //Being tormented if (ActivePokemon.battleProperties.volatileStatusConditions.torment && ActivePokemon.battleProperties.lastMoveId == move.id) { weightings[i] = 0; } float effectivenessModifier = target.species.type2 == null ? TypeAdvantage.CalculateMultiplier(move.type, target.species.type1) : TypeAdvantage.CalculateMultiplier(move.type, target.species.type1, (Type)target.species.type2); //Out of PP if (ActivePokemon.movePPs[i] <= 0) { weightings[i] = 0; } //Status or attack move if (move.moveType == PokemonMove.MoveType.Status) { weightings[i] *= GetStatOEWeighting(statOEMovesUsed); } else { weightings[i] *= GetAttackMoveWeighting(effectivenessModifier); } //Healing weight weightings[i] *= GetHealingMoveWeighint(ActivePokemon.HealthProportion); } } return(weightings); }