Exemplo n.º 1
0
 public void OnPlayerAttackClick(int weaponId, List <CharacterBhv> touchedOpponents, Vector3 touchedPosition = default(Vector3))
 {
     if (touchedOpponents != null)
     {
         foreach (var opponentBhv in touchedOpponents)
         {
             opponentBhv.TakeDamages(PlayerBhv.AttackWithWeapon(weaponId, opponentBhv, _map, touchedPosition: touchedPosition));
         }
     }
     else
     {
         PlayerBhv.AttackWithWeapon(weaponId, null, _map, touchedPosition: touchedPosition);
     }
     //_gridBhv.ShowPm(PlayerBhv, OpponentBhvs);
     _gridBhv.ResetAllCellsDisplay();
 }
Exemplo n.º 2
0
    private int ShouldIWeaponThePlayer()
    {
        int shouldI = 0;

        //The AI is too smart with this :'(
        //foreach (var skillEffect in _opponentBhv.UnderEffects.OrEmptyIfNull())
        //{
        //    if (skillEffect == SkillEffect.Immuned)
        //        shouldI -= 100;
        //    else if (skillEffect == SkillEffect.DefenseUp)
        //        shouldI -= 10;
        //    else
        //        shouldI += 10;
        //}
        shouldI += 10;
        for (int i = 0; i < 2; ++i)
        {
            if (_weaponsWeight[i] <= 0)
            {
                continue;
            }
            float AttackRatioHp    = (float)_characterBhv.AttackWithWeapon(i, _opponentBhv, _gridBhv.Map, usePa: false).Amount / _opponentBhv.Character.Hp;
            float AttackRatioMaxHp = (float)_characterBhv.AttackWithWeapon(i, _opponentBhv, _gridBhv.Map, usePa: false).Amount / _opponentBhv.Character.HpMax;
            if (AttackRatioHp > 1.15f)
            {
                shouldI += 100;
            }
            else if (AttackRatioHp >= 1.0f)
            {
                shouldI += 50;
            }
            else if (AttackRatioMaxHp >= 0.5f)
            {
                shouldI += 30;
            }
            else if (AttackRatioMaxHp >= 0.33f)
            {
                shouldI += 10;
            }
        }
        return(shouldI);
    }