示例#1
0
 public Option(int gameId, Types.PlayerTaskType type, int sourcePosition = 0, int targetPosition = 0, int subOption = 0)
 {
     gameId_         = gameId;
     type_           = type;
     sourcePosition_ = sourcePosition;
     targetPosition_ = targetPosition;
     subOption_      = subOption;
 }
示例#2
0
        public Option(int gameId, Types.PlayerTaskType type,
                      int sourcePosition = -1, int targetPosition  = -1, int subOption = 0,
                      IPlayable source   = null, ICharacter target = null)
        {
            gameId_         = gameId;
            type_           = type;
            sourcePosition_ = sourcePosition;
            targetPosition_ = targetPosition;
            subOption_      = subOption;

            var sb = new StringBuilder();

            switch (type)
            {
            case Types.PlayerTaskType.EndTurn:
                sb.Append($"[END_TURN]");
                break;

            case Types.PlayerTaskType.MinionAttack:
            case Types.PlayerTaskType.HeroAttack:
                sb.Append($"[ATTACK] {source} => {target}");
                break;

            case Types.PlayerTaskType.HeroPower:
                sb.Append($"[HEROPOWER]{source}");
                if (target != null)
                {
                    sb.Append($" => {target}");
                }
                break;

            case Types.PlayerTaskType.PlayCard:
                sb.Append($"[PLAY_CARD] {source}");
                if (target != null)
                {
                    sb.Append($" => {target}");
                }
                if (source.Card.Type == CardType.MINION)
                {
                    sb.Append($"(Pos {targetPosition})");
                }
                else if (source.Card.Type == CardType.SPELL)
                {
                    isSpell_ = true;
                }
                if (subOption > 0)
                {
                    sb.Append($"(Opt {subOption}");
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            print_ = sb.ToString();
        }