Beispiel #1
0
 public override void Activate(int x, int y)
 {
     base.Activate(x, y);
     _currentTargetX = x;
     _currentTargetY = y;
     //CharacterBhv.GainSkillEffect(SkillEffect.Immuned);
     CharacterBhv.StartCoroutine(Helper.ExecuteAfterDelay(PlayerPrefsHelper.GetSpeed(), () =>
     {
         CharacterBhv.LosePm(CharacterBhv.Character.PmMax);
         AfterActivation();
         return(true);
     }));
 }
Beispiel #2
0
    private bool MoveToNextCell()
    {
        bool isAdjacent = _gridBhv.IsAdjacentOpponent(_characterBhv.X, _characterBhv.Y, _characterBhv.OpponentBhvs);

        if (_characterBhv.Pm <= 0 ||
            (isAdjacent && _characterBhv.Pm <= 1))
        {
            return(false);
        }
        var lostPm = isAdjacent ? 2 : 1;

        _characterBhv.LosePm(lostPm);
        _characterBhv.MoveToFirstPathStep();
        return(true);
    }
Beispiel #3
0
    public override void OnEndAttack(int damages, CharacterBhv opponentBhv)
    {
        int tmp = Random.Range(0, 100);
        int pmToRemove;

        if (tmp < 5)
        {
            pmToRemove = 0;
        }
        else if (tmp < 50)
        {
            pmToRemove = 1;
        }
        else if (tmp < 95)
        {
            pmToRemove = 2;
        }
        else
        {
            pmToRemove = 3;
        }
        opponentBhv?.LosePm(pmToRemove);
    }
Beispiel #4
0
    public bool Push(CharacterBhv pushedOpponentBhv)
    {
        _pushedOpponentBhv = pushedOpponentBhv;
        if (_pushedOpponentBhv == null)
        {
            return(false);
        }
        int x = _pushedOpponentBhv.X - CharacterBhv.X;
        int y = _pushedOpponentBhv.Y - CharacterBhv.Y;

        if (!Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) ||
            GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type != CellType.On ||
            GridBhv.IsOpponentOnCell(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, true))
        {
            if ((Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) &&
                 GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type == CellType.Off) ||
                GridBhv.IsOpponentOnCell(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, true))
            {
                var floatAmount = 30.0f * CharacterBhv.Character.GetDamageMultiplier();
                //pushedOpponentBhv.TakeDamages(new Damage((int)floatAmount));
                var damage = new Damage((int)floatAmount);
                CharacterBhv.Instantiator.PopText("-" + pushedOpponentBhv.Character.TakeDamages(damage.Amount).ToString(), pushedOpponentBhv.transform.position, damage.Critical ? TextType.HpCritical : TextType.Hp);
                pushedOpponentBhv.SkinContainer.OnHit();
            }
            else if (!Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) ||
                     GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type == CellType.Impracticable)
            {
                pushedOpponentBhv.LosePm(1);
            }
            return(false);
        }
        _pushedOpponentBhv.AfterMouvementDelegate = AfterPush;
        _pushedOpponentBhv.MoveToPosition(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, false);
        CharacterBhv.Instantiator.NewEffect(InventoryItemType.Skill, GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].transform.position, null, EffectId, Constants.GridMax - (_pushedOpponentBhv.Y + y));
        return(true);
    }