예제 #1
0
        static double GetDefense(Pokemon Opponent, MoveKind MoveKind, BattleViewModel Battle, bool CriticalHit)
        {
            if (MoveKind == MoveKind.Special)
            {
                double special = Opponent.Stats.GetValue(Stats.SpecialDefense, CriticalHit);

                if (Battle.SuppressWeather == 0 && Battle.Weather == Weather.Sandstorm && Opponent.Is(Types.Rock))
                {
                    special *= 1.5;
                }

                return(special);
            }

            double physical = Opponent.Stats.GetValue(Stats.Defense, CriticalHit);

            // Marvel Scale
            if (Opponent.Ability == Ability.MarvelScale &&
                Opponent.NonVolatileStatus != NonVolatileStatus.None)
            {
                physical *= 1.5;
            }

            return(physical);
        }
예제 #2
0
        internal MoveInfo(string Name, Types Type, MoveKind Kind, int?Power, int?Accuracy, int PP, DamageFunction DamageFunction = null, bool IsZ = false)
        {
            this.Name     = Name;
            this.Type     = Type;
            this.Kind     = Kind;
            this.Power    = Power;
            this.PP       = PP;
            this.Accuracy = Accuracy;
            this.IsZ      = IsZ;

            this.DamageFunction = DamageFunction ?? DamageFunctionFactory.DefaultDamageFunction;
            PowerFunction       = DamageFunctionFactory.DefaultPowerFunction;
            AccuracyFunction    = DamageFunctionFactory.DefaultAccuracyFunction;

            Lists.Moves.Add(this);
        }
예제 #3
0
 /// <summary>
 /// Flagged as a "Capture" move
 /// if ChessPiece is king, this is flagged as a "Capture King" move for CheckMate logic
 /// </summary>
 public ChessMove(ChessPiece piece, ChessPiece occupant)
 {
     this.fromPiece = piece;
     if (occupant == ChessPiece.Empty)
     {
         throw new Exception("attempting to 'capture' noting..");
     }
     this.toPiece = occupant;
     if (occupant.kind == PieceKind.King)
     {
         this.kind = MoveKind.CaptureKing;
     }
     else
     {
         this.kind = MoveKind.Capture;
     }
 }
예제 #4
0
        static double GetAttack(Pokemon Attacker, MoveKind MoveKind, BattleViewModel Battle, bool CriticalHit)
        {
            if (MoveKind == MoveKind.Special)
            {
                double special = Attacker.Stats.GetValue(Stats.SpecialAttack, CriticalHit);

                if (Attacker.Ability is AttackMultiplierAbility attackMultiplierAbility &&
                    attackMultiplierAbility.Special &&
                    attackMultiplierAbility.Check(Attacker, null, null, Battle))
                {
                    special *= attackMultiplierAbility.Multiplier;
                }

                // Light Ball
                if (Attacker.HeldItem == HeldItem.LightBall && Attacker.Species == PokemonSpecies.Pikachu)
                {
                    special *= 2;
                }

                return(special);
            }

            double physical = Attacker.Stats.GetValue(Stats.Attack, CriticalHit);

            if (Attacker.Ability is AttackMultiplierAbility attackMultAbility &&
                attackMultAbility.Physical &&
                attackMultAbility.Check(Attacker, null, null, Battle))
            {
                physical *= attackMultAbility.Multiplier;
            }

            // Light Ball
            if (Attacker.HeldItem == HeldItem.LightBall && Attacker.Species == PokemonSpecies.Pikachu)
            {
                physical *= 2;
            }

            return(physical);
        }
예제 #5
0
 /// <summary>
 /// Flagged however you like it
 /// </summary>
 public ChessMove(ChessPiece piece, ChessPiece occupant, MoveKind kind)
 {
     this.fromPiece = piece;
     this.toPiece   = occupant;
     this.kind      = kind;
 }
예제 #6
0
 /// <summary>
 /// Flagged as a "movement" move
 ///
 /// </summary>
 public ChessMove(ChessPiece piece, Point2 to)
 {
     this.fromPiece = piece;
     this.toPiece   = new ChessPiece(to, PieceKind.Empty, PieceColor.Misc);
     this.kind      = MoveKind.Move;
 }