public override Result CheckValid(Minion _minion, PositionVO _target)
	{
		Result result = new Result(true, "");
		PositionVO minionPosition = _minion.Position;
		if (minionPosition.X == _target.X && minionPosition.Y == _target.Y)
			result.SetFailReason("Cant select self");
		if (Mathf.Abs (_target.X - minionPosition.X) > 1 || Mathf.Abs (_target.Y - minionPosition.Y) > 1) 
		{
			result.SetFailReason("Out of Range");
		}
		return result;
	}
	public override Result CheckValid(Minion _minion, PositionVO _target)
	{
		Result result = new Result(true, "");
		Minion targetMinion = MinionManager.Instance.GetMinionByPosition (_target);
		if (targetMinion == null)
			result.SetFailReason("No Target");
		PositionVO minionPosition = _minion.Position;
		if (minionPosition.X == _target.X && minionPosition.Y == _target.Y)
			result.SetFailReason("Cant select self");
		if (Mathf.Abs (_target.X - minionPosition.X) > 1 || Mathf.Abs (_target.Y - minionPosition.Y) > 1) 
		{
			result.SetFailReason("Out of Range");
		}
		return result;
	}
Exemple #3
0
 public override Result CanPutIntoPosition(PositionVO _target)
 {
     Result result = new Result(true, "Success");
     Player curPlayer = GameManager.Instance.GetPlayerByType(PlayerType);
     if (curPlayer.GetEnergy(energyName) < energyCost)
         return result.SetFailReason("Not Enought Mana");
     if ((PlayerType == PlayerType.You && _target.Y == 0) || (PlayerType == PlayerType.Opponent && _target.Y == GameManager.Instance.MapHeight - 1))
     {
         //if (_target.MinionSlotPosition == MinionSlotPosition.Foreward) 
             //return result.SetFailReason("Cannot Summon Minion in the Frontline");
         if (MinionManager.Instance.GetMinionByPosition(_target) != null) 
             return result.SetFailReason("This MinionSlot has already has a minion");
         return result;
     }
     return result.SetFailReason("Can only summon minion in your minion slot");
 }
Exemple #4
0
 public Result<Command> GetNextCommand()
 {
     Result<Command> result = new Result<Command>();
     if (activeCommands.Count <= 0)
     {
         result.SetFailReason("No Commands in this stage");
         return result;
     }
     else
     {
         Command nextCommand = activeCommands[activeCommands.Count - 1];
         result.Success = true;
         result.Obj = nextCommand;
         activeCommands.RemoveAt(activeCommands.Count - 1);
         return result;
     }
 }
Exemple #5
0
    public virtual Result CanPutIntoPosition(PositionVO _target)
    {
        Result result = new Result(true, "Success");
        if(ActionPoint <= 0)
            return result.SetFailReason("No Action Point");
        if(PlayerType != GameManager.Instance.ActivePlayerType)
            return result.SetFailReason("Not Active Player");
        Minion targetMinion = MinionManager.Instance.GetMinionByPosition(_target);
//        if (_target.PlayerType == PlayerType)
 //       {
        if (targetMinion == null)
        {
            return result;
        }
//            else
//                return result.SetFailReason("Already Have Player");
        else
        {
            if (targetStrategies == null)
            {
                targetStrategies = new List<TargetStrategy>();
                targetStrategies.Add(new CloseRangeTargetStrategy());
            }
            TargetResult tTargetResult = TargetResult.InvalidTarget;
            foreach (TargetStrategy strategy in targetStrategies)
            {
                tTargetResult = strategy.Target(this, _target);
            }
            switch (tTargetResult)
            {
                case TargetResult.CloseRangeTargetBack:
                case TargetResult.ValidTarget:
                    return result;
                default:
                    return result.SetFailReason(tTargetResult.ToString());
            }
        }
    }