public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     if (tMinion == null) return "No Valid Minion";
     if (tMinion.MinionSlotPosition == MinionSlotPosition.Foreward)
     {
         List<PositionVO> TargetBacklineEmptyPositions = MinionController.Instance.GetEmptyPositionsByLine(_target.PlayerType, MinionSlotPosition.Backward);
         if (TargetBacklineEmptyPositions.Count != 0)
         {
             int randomValue = Random.Range(0, TargetBacklineEmptyPositions.Count - 1);
             tMinion.MoveToMinionSlot(TargetBacklineEmptyPositions[randomValue]);
         }
     }
     else
     {
         List<PositionVO> TargetFrontlineEmptyPositions = MinionController.Instance.GetEmptyPositionsByLine(_target.PlayerType, MinionSlotPosition.Foreward);
         if (TargetFrontlineEmptyPositions.Count != 0)
         {
             int randomValue = Random.Range(0, TargetFrontlineEmptyPositions.Count - 1);
             tMinion.MoveToMinionSlot(TargetFrontlineEmptyPositions[randomValue]);
         }
     }
     return "Success";
     //return "Can only summon minion in your minion slot";
 }
Exemple #2
0
    public override InputResult CanPutIntoPosition(PositionVO _target)
    {
        InputResult result = new InputResult(true, "Success");

        Minion target = MinionController.Instance.GetMinionByPosition(_target);
        if (_target.PlayerType != PlayerType.Opponent)
        {
            result.SetFailReason("Not Nec Target");
            return result;
        }

        Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
        if (tMinion == null)
        {
            result.SetFailReason("No Minion");
            return result;
        }

        if (tMinion.ContainTag(Tag.Hero))
        {
            result.SetFailReason("Taget Can't be Hero");
            return result;
        }

        return result;
    }
Exemple #3
0
	public virtual string WhenDraggedIntoMinionSlot(PositionVO _target)
	{
		string result = "";
        result = CheckEnergy();
        if (result == "Not Enough Energy")
            return result;
		if (!CheckSkillEnable())
			return "Skill not available";
		Minion tHero = MinionManager.Instance.GetHeroByPlayerType(PlayerType);
		if(tHero == null)
		{
			return "No Hero";
		}
		if (UsingHeroActionPoint && tHero.ActionPoint == 0)
		{
			return "Not Enough Action Point";
		}
		result = DraggedIntoMinionSlot(_target);
		if (result == "Success") {
            CostEnergy();
			CostSkillCD();
			MinionManager.Instance.CheckResult();
			return "Use Skill Success";
		}
		return result;
	}
Exemple #4
0
 public Command(int _minionID, CommandType _type, int _skillNum, PositionVO _target)
 {
     minionID = _minionID;
     type = _type;
     skillNum = _skillNum;
     target = _target;
 }
Exemple #5
0
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tHero = MinionController.Instance.GetHeroByPlayerType(PlayerType);
     if (tHero == null)
         return "No Hero";
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     TargetStrategy tTargetStrategy = new CloseRangeTargetStrategy();
     TargetResult tTargetResult = tTargetStrategy.Target(tHero, _target);
     switch (tTargetResult)
     {
         case TargetResult.InvalidTarget:
             return "No Valid Minion";
         case TargetResult.OutOfRange:
             return "Out of Range";
         case TargetResult.SamePlayer:
             return "Same Player";
         case TargetResult.TargetGuarded:
             return "Target Guarded";
         case TargetResult.ValidTarget:
         case TargetResult.CloseRangeTargetBack:
             tMinion.Hurt(new HurtVO(30, 0, 0));
             return "Success";
         default:
             return "Unknown Result";
     }
 }
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tHero = MinionController.Instance.GetHeroByPlayerType(PlayerType);
     if (tHero == null)
         return "No Hero";
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     TargetStrategy tTargetStrategy = new CloseRangeTargetStrategy();
     TargetResult tTargetResult = tTargetStrategy.Target(tHero, _target);
     switch (tTargetResult)
     {
         case TargetResult.InvalidTarget:
             return "No Valid Minion";
         case TargetResult.OutOfRange:
             return "Out of Range";
         case TargetResult.SamePlayer:
             return "Same Player";
         case TargetResult.TargetGuarded:
             return "Target Guarded";
         case TargetResult.ValidTarget:
         case TargetResult.CloseRangeTargetBack:
             int energy = GameManager.Instance.GetPlayerByType(PlayerType).GetEnergy(EnergyName);
             int targetLostHealth = Mathf.Clamp(tMinion.MaxHealth - tMinion.Health, 0, tMinion.MaxHealth);
             tMinion.Hurt(new HurtVO(energy + 8 + targetLostHealth / 5, 0, 0));
             return "Success";
         default:
             return "Unknown Result";
     }
 }
Exemple #7
0
	// Use this for initialization
	void Start () {
        //foreach (GameObject tCardGO in yourCards)
        //{
        //    SpriteRenderer tSpriteRenderer = tCardGO.GetComponent<SpriteRenderer>();
        //    if (tSpriteRenderer != null)
        //        yourCardsRenderers.Add(tSpriteRenderer);
        //    else
        //        yourCardsRenderers.Add(new SpriteRenderer());
        //}
        //foreach (GameObject tCardGO in opponentCards)
        //{
        //    SpriteRenderer tSpriteRenderer = tCardGO.GetComponent<SpriteRenderer>();
        //    if (tSpriteRenderer != null)
        //        opponentCardsRenderers.Add(tSpriteRenderer);
        //    else
        //        opponentCardsRenderers.Add(new SpriteRenderer());
        //}
        SetInfo("");
        ClearLog();
        InitSprite();
        int width = GameManager.Instance.MapWidth;
        int height = GameManager.Instance.MapHeight;
        for (int i = 0; i < height; ++i)
        {
            for (int j = 0; j < width; ++j)
            {
                MinionSlotController minionSlot = (GameObject.Instantiate(minionSlotPrefab, new Vector3(-200.0f + j * 200.0f, -200.0f + i * 125.0f, 0.0f), Quaternion.identity, minionSlotParent.transform) as GameObject).GetComponent<MinionSlotController>();
                PositionVO position = new PositionVO(j, i);
                minionSlot.Init(position);
                minionSlotDict.Add(position, minionSlot);
            }
        }
        ControlCommandButton(false);
	}
Exemple #8
0
 public override InputResult CanPutIntoPosition(PositionVO _target)
 {
     InputResult result = new InputResult(true, "Success");
     List<Minion> tMinions = MinionController.Instance.GetMinionsByPlayerType(PlayerType.Opponent);
     if (tMinions == null)
         result.SetFailReason("No Valid Minion");
     return result;
 }
Exemple #9
0
 public override InputResult CanPutIntoPosition(PositionVO _target)
 {
     InputResult result = new InputResult(true, "Success");
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     if (tMinion == null)
         result.SetFailReason("No Minion");
     return result;
 }
    public override void Excute(Minion _minion, PositionVO _target)
    {
 	    base.Excute(_minion, _target);
        Minion targetMinion = MinionManager.Instance.GetMinionByPosition(_target);
        if (targetMinion == null)
            return;
        targetMinion.BeingAttacked(_minion);
    }
Exemple #11
0
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     if (tMinion == null) return "No Valid Minion";
     tMinion.Hurt(new HurtVO(0, 5, 0));
     GameManager.Instance.GetPlayerByType(PlayerType).CostEnergy(energyName, energyCost);
     return "Use Magic Success";
     //return "Can only summon minion in your minion slot";
 }
Exemple #12
0
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     if (tMinion == null) return "No Valid Minion";
     List<Minion> tHeros = MinionController.Instance.GetHeroesByPlayerType(PlayerType);
     tMinion.Hurt(new HurtVO(0, tHeros[0].PhysicalDamage, 0));
     return "Success";
     //return "Can only summon minion in your minion slot";
 }
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tHero = MinionController.Instance.GetMinionByPosition(_target);
     if(tHero  == null || !tHero.ContainTag(Tag.Hero)) 
         return "Invalid target";
     if (_target.PlayerType != PlayerType) 
         return "Cannot Used On Opponent MinionSlot";
     tHero.AddBuff(new StateOfDeathBuff());
     return "Success";
 }
Exemple #14
0
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     List<Minion> tMinions = MinionController.Instance.GetMinionsByPlayerType(PlayerType.Opponent);
     if (tMinions == null) return "No Valid Minion";
     foreach (Minion tMinion in tMinions)
     {
         tMinion.Hurt(new HurtVO(5, 0, 0));
     }
     return "Success";
 }
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     if (tMinion == null) return "No Valid Minion";
     SlowedBuff slowedBuff = new SlowedBuff();
     slowedBuff.Duration = 2;
     tMinion.AddBuff(slowedBuff);
     return "Success";
     //return "Can only summon minion in your minion slot";
 }
 public override TargetResult Target(Minion _me, PositionVO _target)
 {
     if(false)// (_target.PlayerType == _me.PlayerType)
     {
         return TargetResult.SamePlayer;
     }
     else
     {
         Minion tMinion = MinionManager.Instance.GetMinionByPosition(_target);
         if (tMinion == null)
         {
             return TargetResult.InvalidTarget;
         }
         else
         {
             if(false) //(_me.MinionSlotPosition == MinionSlotPosition.Backward)
             {
                 return TargetResult.OutOfRange;
             }
             else
             {
                 if (false)//(_target.MinionSlotPosition == MinionSlotPosition.Foreward)
                 {
                     if(IsGuardOrNoOtherGuardInFrontline(_target))
                     {
                         return TargetResult.ValidTarget;
                     }
                     else
                     {
                         return TargetResult.TargetGuarded;
                     }
                 }
                 else
                 {
                     if(_me.ContainBuff(BuffName.Rooted) || _me.ContainBuff(BuffName.Slowed))
                     {
                         return TargetResult.OutOfRange;
                     }
                     else
                     {
                         //if (NoOtherGuardInFrontline(_target))
                         if (NoOtherMinionInFrontline(_target))
                         {
                             return TargetResult.CloseRangeTargetBack;
                         }
                         else
                         {
                             return TargetResult.TargetGuarded;
                         }
                     }
                 }
             }
         }
     }
 }
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     if (tMinion == null) return "No Valid Minion";
     AddPhysicalAttackBuff lightOnWeaponBuff = new AddPhysicalAttackBuff();
     lightOnWeaponBuff.Duration = 3;
     lightOnWeaponBuff.PhysicalDamage = 2;
     tMinion.AddBuff(lightOnWeaponBuff);
     return "Success";
     //return "Can only summon minion in your minion slot";
 }
 public override InputResult CanPutIntoPosition(PositionVO _target)
 {
     //InputResult result = new InputResult(true, "Success");
     //List<PositionVO> emptyPositions = MinionController.Instance.GetEmptyPositionsByPlayerType(PlayerType);
     //if (emptyPositions.Count == 0)
     //{
     //    result.SetFailReason("Use Magic Failed");
     //}
     //return result;
     return new InputResult(false, "");
 }
Exemple #19
0
 public override InputResult CanPutIntoPosition(PositionVO _target)
 {
     InputResult result = new InputResult(true, "Success");
     Minion minion = MinionController.Instance.GetMinionByPosition(_target);
     if (minion == null)
     {
         return result.SetFailReason("No Valid Minion");
     }
     if (minion.PlayerType == PlayerType)
         result.SetFailReason("Not Enemy Minion");
     return result;
 }
Exemple #20
0
 protected bool NoOtherMinionInFrontline(PositionVO _target)
 {
     //List<Minion> opponentFrontLine = MinionController.Instance.GetMinionsByLine(_target.PlayerType, MinionSlotPosition.Foreward);
     //foreach (Minion opponentMinion in opponentFrontLine)
     //{
     //    if (opponentMinion != null)
     //    {
     //        return false;
     //    }
     //}
     return true;
 }
	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;
	}
Exemple #22
0
 public override InputResult CanPutIntoPosition(PositionVO _target)
 {
     InputResult result = new InputResult(true, "Success");
     Minion target = MinionController.Instance.GetMinionByPosition(_target);
     if (target == null)
         return result.SetFailReason("No Valid Minion");
     if (target.PlayerType == PlayerType.Opponent || target.PlayerType == PlayerType.You)
     {
         return result;
     }
     return result.SetFailReason("No Valid Minion");
 }
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     CardTargetStrategy _cardTargetStrategy = new SummonMinionUsingMagicCard("CardSkeleton");
     if (_cardTargetStrategy.Excute(this, _target) == "Summon Minion Success")
     {
         return "Success";
     }
     else
     {
         return "Use Magic Failed";
     }
 }
 public override string WhenDraggedIntoMinionSlot(PositionVO _target)
 {
     Player curPlayer = GameManager.Instance.GetPlayerByType(PlayerType);
     if (curPlayer.GetEnergy(energyName) < MINIMAL_COST) return "Not Enough Energy";
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     if (tMinion == null) return "No Valid Minion";
     int halfEnergy = Mathf.FloorToInt(curPlayer.GetEnergy(energyName) / 2);
     tMinion.Hurt(new HurtVO(0, halfEnergy, 0));
     GameManager.Instance.GetPlayerByType(PlayerType).CostEnergy(energyName, halfEnergy);
     return "Use Magic Success";
     //return "Can only summon minion in your minion slot";
 }
Exemple #25
0
 public void SetCommand(int _minionID, CommandType _type, int _skillNum, PositionVO _target)
 {
     Command newCommand = new Command(_minionID, _type, _skillNum, _target);
     if(minionCommandDict.ContainsKey(_minionID))
     {
         minionCommandDict[_minionID] = newCommand;
     }
     else
     { 
         minionCommandDict.Add(_minionID, newCommand);
     }
 }
Exemple #26
0
    public override string WhenDraggedIntoMinionSlot(PositionVO _target)
    {
        Minion target = MinionController.Instance.GetMinionByPosition(_target);
        if (target == null)
            return "No Valid Minion";

        if (target.PlayerType == PlayerType.You)
        {
            target.DefenceArmor = this;
            return "Use DefenceArmor Success";
        }
        return "No Valid Minion";
    }
Exemple #27
0
 public override InputResult CanPutIntoPosition(PositionVO _target)
 {
     InputResult result = new InputResult(true, "Success");
     Minion tHero = MinionController.Instance.GetHeroByPlayerType(PlayerType);
     if (tHero == null)
         result.SetFailReason("No Hero");
     if (_target.PlayerType != PlayerType)
         result.SetFailReason("Not Friendly Minion");
     Minion tMinion = MinionController.Instance.GetMinionByPosition(_target);
     if (tMinion == null)
         result.SetFailReason("No Minion");
     return result;
 }
Exemple #28
0
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     Minion tHero = MinionController.Instance.GetMinionByPosition(_target);
     if (tHero == null || !tHero.ContainTag(Tag.Hero))
         return "Invalid target";
     if (_target.PlayerType != PlayerType)
         return "Cannot Used On Opponent MinionSlot";
     AddPhysicalAttackBuff focusBuff = new AddPhysicalAttackBuff();
     focusBuff.Duration = 3;
     focusBuff.PhysicalDamage = 2;
     tHero.AddBuff(focusBuff);
     return "Success";
 }
Exemple #29
0
 protected bool IsGuard(PositionVO _target)
 {
     Minion tTargetMinion = MinionManager.Instance.GetMinionByPosition(_target);
     if (tTargetMinion == null) return false;
     if (tTargetMinion.ContainTag(Tag.Guard))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 public override string DraggedIntoMinionSlot(PositionVO _target)
 {
     CardTargetStrategy _cardTargetStrategy = new SummonMinionUsingMagicCard("CardSkeletonArcher");
     if (_cardTargetStrategy.Excute(this, _target) == "Summon Minion Success")
     {
         return "Success";
     }
     else
     {
         return "Failed";
     }
     //return "Can only summon minion in your minion slot";
 }