Ejemplo n.º 1
0
        public static bool En(Field field, MoveTypeE move)
        {
            var hazards = GetHazards(field);

            if (hazards == null)
            {
                hazards = new List <Condition>();
                field.AddCondition(Cs.Hazards, hazards);
            }
            foreach (var eh in hazards)
            {
                if (eh.Move == move)
                {
                    return(En(eh));
                }
            }
            var newh = new Condition()
            {
                Move = move
            };

            if (move.Id == Ms.SPIKES)
            {
                newh.Int = 8;
            }
            hazards.Add(newh);
            return(true);
        }
Ejemplo n.º 2
0
        private static void Metronome(AtkContext atk)
        {
LOOP:
            var m = MoveTypeE.Get(atk.Controller.GetRandomInt(1, RomData.MOVES));

            if (METRONOME_BLOCK.Contains(m.Id) || m.Zmove)
            {
                goto LOOP;
            }
            atk.StartExecute(m, null, "Metronome");
        }
Ejemplo n.º 3
0
        private static void NaturePower(AtkContext atk, Tile selectTile = null)
        {
            MoveTypeE m;

            switch (atk.Controller.GameSettings.Terrain)
            {
            case Terrain.Path:
                m = MoveTypeE.Get(Ms.TRI_ATTACK);
                break;

            default:
                atk.Controller.ReportBuilder.ShowLog("error");
                return;
            }
            atk.StartExecute(m, selectTile, "NaturePower");
        }
Ejemplo n.º 4
0
 public static bool CanExecuteMove(PokemonProxy pm, MoveTypeE move)
 {
     //重力
     if (move.UnavailableWithGravity && pm.Controller.Board.HasCondition(Cs.Gravity))
     {
         pm.ShowLogPm("GravityCantUseMove", move.Id);
         return(false);
     }
     //回复封印
     if (move.Heal && pm.OnboardPokemon.HasCondition(Cs.HealBlock))
     {
         pm.ShowLogPm("HealBlockCantUseMove", move.Id);
         return(false);
     }
     return(true);
 }
        private static void NaturePower(AtkContext atk)
        {
            MoveTypeE m;

            switch (atk.Controller.GameSettings.Terrain)
            {
            case Terrain.Path:
                m = MoveTypeE.Get(Ms.EARTHQUAKE);
                break;

            default:
                atk.Controller.ReportBuilder.ShowLog("error");
                return;
            }
            atk.StartExecute(m, null, "NaturePower");
        }
Ejemplo n.º 6
0
        public static void De(ReportBuilder report, Field field, MoveTypeE move)
        {
            var hazards = GetHazards(field);

            if (hazards != null)
            {
                foreach (var eh in hazards)
                {
                    if (eh.Move == move)
                    {
                        hazards.Remove(eh);
                        DeReport(report, eh, field);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private static void Assist(AtkContext atk)
        {
            var aer   = atk.Attacker;
            var moves = new List <MoveTypeE>();

            foreach (var pm in aer.Pokemon.Owner.Pokemons)
            {
                foreach (var m in pm.Pokemon.Moves)
                {
                    if (pm != aer && !(ASSIST_BLOCK.Contains(m.Type.Id)))
                    {
                        moves.Add(MoveTypeE.Get(m.Type));
                    }
                }
            }
            if (moves.Count == 0)
            {
                atk.FailAll();
            }
            else
            {
                atk.StartExecute(moves[aer.Controller.GetRandomInt(0, moves.Count - 1)]);
            }
        }
Ejemplo n.º 8
0
 //*********************************************************     
 //
 /// <summary>
 /// Add a move to the move list if the move doesn't provokes the king to be attacked.
 /// </summary>
 /// <param name="ePlayerColor">     Color doing the the move</param>
 /// <param name="iStartPos">        Starting position</param>
 /// <param name="iEndPos">          Ending position</param>
 /// <param name="eType">            type of the move</param>
 /// <param name="arrMovePos">       List of move</param>
 //  
 //*********************************************************     
 private void AddIfNotCheck(PlayerColorE ePlayerColor, int iStartPos, int iEndPos, MoveTypeE eType, List<MovePosS> arrMovePos) {
     PieceE      eNewPiece;
     PieceE      eOldPiece;
     MovePosS    tMovePos;
     bool        bIsCheck;
     
     eOldPiece           = m_pBoard[iEndPos];
     eNewPiece           = m_pBoard[iStartPos];
     m_pBoard[iEndPos]   = eNewPiece;
     m_pBoard[iStartPos] = PieceE.None;
     bIsCheck            = ((eNewPiece & PieceE.PieceMask) == PieceE.King) ? IsCheck(ePlayerColor, iEndPos) : IsCheck(ePlayerColor);
     m_pBoard[iStartPos] = m_pBoard[iEndPos];
     m_pBoard[iEndPos]   = eOldPiece;
     if (!bIsCheck) {
         tMovePos.OriginalPiece  = m_pBoard[iEndPos];
         tMovePos.StartPos       = (byte)iStartPos;
         tMovePos.EndPos         = (byte)iEndPos;
         tMovePos.Type           = eType;
         if (m_pBoard[iEndPos] != PieceE.None || eType == MoveTypeE.EnPassant) {
             tMovePos.Type |= MoveTypeE.PieceEaten;
             m_iAttackedPieces++;
         }
         if (arrMovePos != null) {
             arrMovePos.Add(tMovePos);
         }
     }
 }