Example #1
0
    public bool TryAddTarget(TBC_Entity entity)
    {
        if (!selectedTargets.Contains(entity))
        {
            selectedTargets.Add(entity);

            int targetEntityCount = 0;
            switch (targetType)
            {
            case TargetTypes.Player:
                targetEntityCount = TBC_GameManager.instance.playerEntities.Count;
                break;

            case TargetTypes.Enemy:
                targetEntityCount = TBC_GameManager.instance.enemyEntities.Count;
                break;
            }

            if (affectsAll || selectedTargets.Count >= maxTargets || selectedTargets.Count >= targetEntityCount)
            {
                ApplyItemToTargets();

                return(true);
            }
        }

        return(false);
    }
    public override void ApplyAttack(TBC_Entity entity)
    {
        if (destroysArmor)
        {
            entity.healthModel.armor = 0;
        }

        base.ApplyAttack(entity);

        TBC_DOTStatusEffect dot = entity.gameObject.AddComponent <TBC_DOTStatusEffect>();

        dot.InitializeStatusEffect(dotDuration, entity);
        dot.bleedDamage = dotDamage;
    }
Example #3
0
 public void TrySelectTarget(TBC_Entity target)
 {
     if (TBC_GameManager.instance.playerSelectedAttack != null)
     {
         if (
             IsTargetingEnemy(TBC_GameManager.instance.playerSelectedAttack.targetType, target) ||
             IsTargetingPlayer(TBC_GameManager.instance.playerSelectedAttack.targetType, target)
             )
         {
             if (TBC_GameManager.instance.playerSelectedAttack.TryAddTarget(target))
             {
                 NextTurn();
             }
             else
             {
                 target.spriteUI.selectedSprite.SetActive(true);
             }
         }
     }
     else if (TBC_GameManager.instance.playerSelectedItem != null)
     {
         if (
             IsTargetingEnemy(TBC_GameManager.instance.playerSelectedItem.targetType, target) ||
             IsTargetingPlayer(TBC_GameManager.instance.playerSelectedItem.targetType, target)
             )
         {
             if (TBC_GameManager.instance.playerSelectedItem.TryAddTarget(target))
             {
                 NextTurn();
             }
             else
             {
                 target.spriteUI.selectedSprite.SetActive(true);
             }
         }
     }
 }
Example #4
0
 private bool IsTargetingEnemy(TargetTypes actionType, TBC_Entity target) => actionType == TargetTypes.Enemy && target.GetType() == typeof(TBC_EnemyEntity);
Example #5
0
 private bool IsTargetingPlayer(TargetTypes actionType, TBC_Entity target) => actionType == TargetTypes.Player && target.GetType() == typeof(TBC_PlayerEntity);
 public void InitializeStatusEffect(int duration, TBC_Entity entity)
 {
     this.duration  = duration;
     attachedEntity = entity;
     attachedEntity.startTurnEvent.AddListener(() => ApplyEffect());
 }
 public virtual void ApplyAttack(TBC_Entity entity)
 {
     entity.DealDamage(damage, isPiercing);
 }