public override int GetSimulatedVitDamage(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        int output = 0;

        foreach (GameObject targ in target)
        {
            HealthController targetHealthController = targ.GetComponent <HealthController>();
            if (card.GetTempEffectValue() == 0)
            {
                if (card.effectValue[effectIndex] != 0)
                {
                    output += Mathf.CeilToInt(caster.GetComponent <HealthController>().GetAttack() * Mathf.Abs(card.effectValue[effectIndex]) / 100.0f) * Mathf.RoundToInt(Mathf.Sign(card.effectValue[effectIndex]));
                }
                else
                {
                    output += caster.GetComponent <HealthController>().GetAttack();
                }
            }
            else
            {
                if (card.effectValue[effectIndex] != 0)
                {
                    output += Mathf.CeilToInt(card.GetTempEffectValue() * Mathf.Abs(card.effectValue[effectIndex]) / 100.0f) * Mathf.RoundToInt(Mathf.Sign(card.effectValue[effectIndex]));
                }
                else
                {
                    output += Mathf.CeilToInt(caster.GetComponent <HealthController>().GetAttack() * card.GetTempEffectValue() / 100.0f);
                }
            }
        }
        return(output);
    }
Example #2
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     if (!target.All(x => x.GetComponent <HealthController>().size > 1))
     {
         Vector2 newLoc = target[0].transform.position;
         foreach (GameObject obj in target)
         {
             if (obj.GetComponent <HealthController>().size == 1)
             {
                 GridController.gridController.RemoveFromPosition(obj, obj.transform.position);
                 obj.transform.position = caster.transform.position;
                 GridController.gridController.ReportPosition(obj, obj.transform.position);
                 try
                 {
                     obj.GetComponent <PlayerMoveController>().TeleportTo(obj.transform.position);
                 }
                 catch { }
             }
         }
         try
         {
             caster.GetComponent <PlayerMoveController>().UpdateOrigin(caster.transform.position);
         }
         catch { }
         GridController.gridController.RemoveFromPosition(caster, caster.transform.position);
         caster.transform.position = newLoc;
         GridController.gridController.ReportPosition(caster, caster.transform.position);
         try
         {
             caster.GetComponent <PlayerMoveController>().TeleportTo(caster.transform.position);
         }
         catch { }
     }
     yield return(new WaitForSeconds(0));
 }
Example #3
0
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        List <Card> spawnCards = new List <Card>();

        foreach (Card spawnCard in card.cards)
        {
            if (spawnCard != null)
            {
                spawnCards.Add(spawnCard);
            }
        }
        if (spawnCards.Count == 0)
        {
            for (int i = 0; i < card.effectValue[effectIndex]; i++) //Draw effectValue number of random cards
            {
                HandController.handController.DrawAnyCard();
            }
        }
        else
        {
            foreach (Card spawnCard in card.cards)   //Draw all the specified cards
            {
                CardController thisCard = new CardController();
                thisCard.SetCard(spawnCard, false, false);
                HandController.handController.DrawSpecificCard(thisCard);
            }
        }
        yield return(new WaitForSeconds(0));
    }
    public override void Process(GameObject caster, CardEffectsController effectController, Vector2 location, Card card, int effectIndex)
    {
        GameObject trap = GameObject.Instantiate(card.spawnObject[effectIndex], location, Quaternion.identity);

        trap.transform.parent = CanvasController.canvasController.boardCanvas.transform;
        trap.GetComponent <TrapController>().SetValues(card, effectIndex + 1);
    }
Example #5
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     foreach (GameObject targ in target)
     {
         targ.GetComponent <HealthController>().Cleanse();
     }
     yield return(new WaitForSeconds(0));
 }
Example #6
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     foreach (GameObject targ in target)
     {
         targ.GetComponent <EnemyController>().SetTaunt(caster, card.effectDuration[effectIndex]);
     }
     yield return(new WaitForSeconds(0));
 }
Example #7
0
 public override void Process(GameObject caster, CardEffectsController effectController, GameObject target, Card card, int effectIndex)
 {
     GameObject[] targets = GameObject.FindGameObjectsWithTag("Enemy");
     foreach (GameObject thisTarget in targets)
     {
         thisTarget.GetComponent <HealthController>().TakePiercingDamage(card.effectValue[effectIndex]);
     }
 }
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     GameObject[] targets = GameObject.FindGameObjectsWithTag("Enemy");
     foreach (GameObject thisTarget in targets)
     {
         thisTarget.GetComponent <HealthController>().TakeShieldDamage(card.effectValue[effectIndex], caster.GetComponent <HealthController>());
     }
     yield return(new WaitForSeconds(0));
 }
Example #9
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     foreach (GameObject targ in target)
     {
         HealthController targetHealth = targ.GetComponent <HealthController>();
         effectController.GetCard().GetCard().SetTempEffectValue(targetHealth.GetBonusShield());
     }
     yield return(new WaitForSeconds(0));
 }
Example #10
0
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        List <CardController> hand = HandController.handController.GetHand();

        hand[hand.Count - 1].SetEnergyCostDiscount(card.effectValue[effectIndex]);
        hand[hand.Count - 1].SetManaCostDiscount(card.effectValue[effectIndex]);
        HandController.handController.ResetCardDisplays();
        HandController.handController.ResetCardPlayability(TurnController.turnController.GetCurrentEnergy(), TurnController.turnController.GetCurrentMana());
        yield return(new WaitForSeconds(0));
    }
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     for (int i = 0; i < card.effectValue[effectIndex]; i++) //Draw effectValue number of mana cards
     {
         bool successful;
         successful = HandController.handController.DrawManaCard(); //Draws the card and logs if it was successful
         card.SetPreviousEffectSuccessful(successful);
     }
     yield return(new WaitForSeconds(0));
 }
Example #12
0
    public override int GetSimulatedVitDamage(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        int output   = 0;
        int duration = 1;

        if (card.effectDuration[effectIndex] != 0)
        {
            duration = card.effectDuration[effectIndex];
        }
        else if (card.GetTempDuration() != 0)
        {
            duration = card.GetTempDuration();
        }

        for (int i = 0; i < duration; i++)
        {
            foreach (GameObject targ in target)
            {
                int value = 0;
                HealthController targetHealthController = targ.GetComponent <HealthController>();
                if (card.GetTempEffectValue() == 0)
                {
                    if (card.effectValue[effectIndex] != 0)
                    {
                        value += targetHealthController.GetSimulatedVitDamage(Mathf.CeilToInt(caster.GetComponent <HealthController>().GetAttack() * card.effectValue[effectIndex] / 100.0f));
                    }
                    else
                    {
                        value += targetHealthController.GetSimulatedVitDamage(caster.GetComponent <HealthController>().GetAttack());
                    }
                }
                else
                {
                    if (card.effectValue[effectIndex] != 0)
                    {
                        value += targetHealthController.GetSimulatedVitDamage(Mathf.CeilToInt(card.GetTempEffectValue() * card.effectValue[effectIndex] / 100.0f));
                    }
                    else
                    {
                        value += targetHealthController.GetSimulatedVitDamage(Mathf.CeilToInt(caster.GetComponent <HealthController>().GetAttack() * card.GetTempEffectValue() / 100.0f));
                    }
                }

                if (targetHealthController.GetCurrentShield() > 0)
                {
                    output += Mathf.Max(value - targetHealthController.GetCurrentShield(), 1);
                }
                else
                {
                    output += value * 2;
                }
            }
        }
        return(output);
    }
Example #13
0
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <Vector2> target, Card card, int effectIndex)
    {
        try
        {
            caster.GetComponent <PlayerMoveController>().TeleportTo(target[0]);
            caster.transform.position = target[0];
        }
        catch { }

        yield return(new WaitForSeconds(0));
    }
Example #14
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     if (card.effectValue[effectIndex] == 0)
     {
         TurnController.turnController.GainMana(card.GetTempEffectValue());
     }
     else
     {
         TurnController.turnController.GainMana(card.effectValue[effectIndex]);
     }
     yield return(new WaitForSeconds(0));
 }
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        string[] targetTag = new string[] { "Player", "Enemy" };
        int      size      = caster.GetComponent <HealthController>().size;

        switch (card.targetType[effectIndex])
        {
        case Card.TargetType.Enemy:
            targetTag = new string[] { "Enemy" };
            break;

        case Card.TargetType.AllEnemies:
            targetTag = new string[] { "Enemy" };
            break;

        case Card.TargetType.Player:
            targetTag = new string[] { "Player" };
            break;

        case Card.TargetType.AllPlayers:
            targetTag = new string[] { "Player" };
            break;

        case Card.TargetType.Any:
            targetTag = new string[] { "Player", "Enemy" };
            break;

        case Card.TargetType.Self:
            try
            {
                caster.GetComponent <EnemyController>();
                targetTag = new string[] { "Enemy" };
            }
            catch
            {
                targetTag = new string[] { "Player" };
            }
            break;

        default:
            targetTag = new string[] { "xxxxxxxxxxxxxxxx" };
            break;
        }
        List <GameObject> objects = GridController.gridController.GetObjectsInAoE(caster.transform.position, card.radius, targetTag);

        if (objects.Contains(caster))
        {
            objects.Remove(caster);
        }
        effectController.GetCard().GetCard().SetTempEffectValue(objects.Count);
        yield return(new WaitForSeconds(0));
    }
Example #16
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     if (card.effectDuration[effectIndex] != 0)
     {
         card.SetTempDuration(card.effectDuration[effectIndex]);
     }
     else
     {
         card.SetTempDuration(card.GetTempEffectValue());
         card.SetTempEffectValue(0);
     }
     yield return(new WaitForSeconds(0));
 }
Example #17
0
    public override void Process(GameObject caster, CardEffectsController effectController, GameObject target, Card card, int effectIndex)
    {
        HealthController targetHealth = target.GetComponent <HealthController>();

        if (card.effectValue[effectIndex] != 0)
        {
            targetHealth.ChangeAttack(card.effectValue[effectIndex]);
        }
        else
        {
            targetHealth.ChangeAttack(effectController.GetCard().GetTempEffectValue());
        }
    }
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        List <GameObject> deepCopy = new List <GameObject>();

        foreach (GameObject obj in target) //Prevent list modify error
        {
            deepCopy.Add(obj);
        }
        foreach (GameObject targ in deepCopy)
        {
            targ.GetComponent <HealthController>().ForcedMovement(caster.transform.position, card.effectValue[effectIndex]);
        }
        yield return(new WaitForSeconds(0));
    }
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        int count = 0;

        foreach (EnemyController enemy in TurnController.turnController.GetEnemies())
        {
            if (enemy.desiredTarget.Any(o => o == caster))
            {
                count++;
            }
        }
        card.SetTempEffectValue(count);
        yield return(new WaitForSeconds(0));
    }
Example #20
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     foreach (GameObject targ in target)
     {
         HealthController targetHealthController = targ.GetComponent <HealthController>();
         if (card.effectValue[effectIndex] != 0)
         {
             targetHealthController.TakeVitDamage(caster.GetComponent <HealthController>().GetAttack(), caster.GetComponent <HealthController>());
         }
         else
         {
             targetHealthController.TakeVitDamage(caster.GetComponent <HealthController>().GetAttack() + card.GetTempEffectValue(), caster.GetComponent <HealthController>());
         }
     }
     yield return(new WaitForSeconds(0));
 }
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     foreach (GameObject targ in target)
     {
         HealthController targetHealthController = targ.GetComponent <HealthController>();
         if (card.GetTempEffectValue() == 0)
         {
             targetHealthController.TakeShieldDamage(card.effectValue[effectIndex], caster.GetComponent <HealthController>());
         }
         else
         {
             targetHealthController.TakeShieldDamage(Mathf.CeilToInt(card.GetTempEffectValue() * card.effectValue[effectIndex] / 100.0f), caster.GetComponent <HealthController>());
         }
     }
     yield return(new WaitForSeconds(0));
 }
Example #22
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     foreach (GameObject targ in target)
     {
         HealthController targetH = targ.GetComponent <HealthController>();
         if (card.effectValue[effectIndex] != 0)
         {
             GetBuff(card.buffType[effectIndex]).OnApply(targetH, card.effectValue[effectIndex], card.effectDuration[effectIndex], false);
         }
         else
         {
             GetBuff(card.buffType[effectIndex]).OnApply(targetH, card.GetTempEffectValue(), card.effectDuration[effectIndex], false);
         }
     }
     yield return(new WaitForSeconds(0));
 }
Example #23
0
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        Vector2 center = card.GetCenter();

        foreach (GameObject obj in target)
        {
            try
            {
                obj.GetComponent <PlayerMoveController>().TeleportTo(center);
            }
            catch { }
            GridController.gridController.RemoveFromPosition(obj, obj.transform.position);
            obj.transform.position = center;
            GridController.gridController.ReportPosition(obj, center);
        }
        yield return(new WaitForSeconds(0));
    }
    public override int GetSimulatedShieldDamage(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        int output = 0;

        foreach (GameObject targ in target)
        {
            HealthController targetHealthController = targ.GetComponent <HealthController>();
            if (card.GetTempEffectValue() == 0)
            {
                output += targetHealthController.GetSimulatedShieldDamage(card.effectValue[effectIndex]);
            }
            else
            {
                output += targetHealthController.GetSimulatedShieldDamage(Mathf.CeilToInt(card.GetTempEffectValue() * card.effectValue[effectIndex] / 100.0f));
            }
        }
        return(output);
    }
Example #25
0
 public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
 {
     foreach (GameObject targ in target)
     {
         if (targ == caster)
         {
             continue;
         }
         targ.GetComponent <AbilitiesController>().TriggerAbilities(AbilitiesController.TriggerType.OnSacrifice);
         if (targ.tag == "Enemy")
         {
             targ.GetComponent <EnemyController>().SetSacrificed(true);
             GridController.gridController.RemoveFromPosition(targ, targ.transform.position);
             targ.transform.position = new Vector2(99, 99);
         }
     }
     yield return(new WaitForSeconds(0));
 }
Example #26
0
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        int totalDamageValue = 0;
        int duration         = 1;

        if (card.effectDuration[effectIndex] != 0)
        {
            duration = card.effectDuration[effectIndex];
        }
        else if (card.GetTempDuration() != 0)
        {
            duration = card.GetTempDuration();
        }

        for (int i = 0; i < duration; i++)
        {
            foreach (GameObject targ in target)
            {
                int damageValue = 0;
                HealthController targetHealthController = targ.GetComponent <HealthController>();
                if (card.GetTempEffectValue() == 0)
                {
                    damageValue = Mathf.CeilToInt(caster.GetComponent <HealthController>().GetAttack() * card.effectValue[effectIndex] / 100.0f);
                }
                else
                {
                    if (card.effectValue[effectIndex] != 0)
                    {
                        damageValue = Mathf.CeilToInt(card.GetTempEffectValue() * card.effectValue[effectIndex] / 100.0f);
                    }
                    else
                    {
                        damageValue = Mathf.CeilToInt(caster.GetComponent <HealthController>().GetAttack() * card.GetTempEffectValue() / 100.0f);
                    }
                }

                totalDamageValue += targetHealthController.GetSimulatedVitDamage(damageValue);
                targetHealthController.TakeVitDamage(damageValue, caster.GetComponent <HealthController>());
            }
            yield return(new WaitForSeconds(TimeController.time.attackBufferTime * TimeController.time.timerMultiplier));
        }

        card.SetDamageDone(totalDamageValue);
    }
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <Vector2> location, Card card, int effectIndex)
    {
        if (location.Count != 1)
        {
            throw new KeyNotFoundException();
        }

        Vector2    loc = location[0];
        GameObject obj;

        for (int i = 0; i < card.effectValue[effectIndex]; i++)
        {
            if (card.castType == Card.CastType.AoE || card.castType == Card.CastType.TargetedAoE)
            {
                List <Vector2> viableLocations = GridController.gridController.GetEmptyLocationsInAoE(location[0], card.radius);

                if (viableLocations.Count == 0)
                {
                    break;
                }

                loc = viableLocations[Random.Range(0, viableLocations.Count)];
                obj = GameObject.Instantiate(card.spawnObject[effectIndex], loc, Quaternion.identity);
            }
            else
            {
                obj = GameObject.Instantiate(card.spawnObject[effectIndex], loc, Quaternion.identity);
            }
            obj.transform.parent = CanvasController.canvasController.boardCanvas.transform;
            try
            {
                obj.GetComponent <TrapController>().SetValues(caster, card, effectIndex + 1);
            }
            catch
            {
                obj.GetComponent <EnemyController>().Spawn(loc);
                obj.GetComponent <HealthController>().SetCreator(caster);
                obj.GetComponent <EnemyController>().SetSkipInitialIntent(true);
            }
        }
        yield return(new WaitForSeconds(0));
    }
    public override IEnumerator Process(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        int totalDamageValue = 0;

        foreach (GameObject targ in target)
        {
            int damageValue = 0;
            HealthController targetHealthController = targ.GetComponent <HealthController>();
            if (card.GetTempEffectValue() == 0)
            {
                if (card.effectValue[effectIndex] != 0)
                {
                    damageValue = Mathf.CeilToInt(caster.GetComponent <HealthController>().GetAttack() * Mathf.Abs(card.effectValue[effectIndex]) / 100.0f) * Mathf.RoundToInt(Mathf.Sign(card.effectValue[effectIndex]));
                }
                else
                {
                    damageValue = caster.GetComponent <HealthController>().GetAttack();
                }
            }
            else
            {
                if (card.effectValue[effectIndex] != 0)
                {
                    damageValue = Mathf.CeilToInt(card.GetTempEffectValue() * Mathf.Abs(card.effectValue[effectIndex]) / 100.0f) * Mathf.RoundToInt(Mathf.Sign(card.effectValue[effectIndex]));
                }
                else
                {
                    damageValue = Mathf.CeilToInt(caster.GetComponent <HealthController>().GetAttack() * card.GetTempEffectValue() / 100.0f);
                }
            }
            totalDamageValue += damageValue;
            targetHealthController.TakePiercingDamage(damageValue, caster.GetComponent <HealthController>());
        }
        yield return(new WaitForSeconds(TimeController.time.attackBufferTime * TimeController.time.timerMultiplier));

        card.SetDamageDone(totalDamageValue);
    }
Example #29
0
    public override int GetSimulatedShieldDamage(GameObject caster, CardEffectsController effectController, List <GameObject> target, Card card, int effectIndex)
    {
        int output = 1;

        foreach (GameObject targ in target)
        {
            HealthController targetHealthController = targ.GetComponent <HealthController>();
            output += targetHealthController.GetEnfeeble();
            if (targetHealthController.GetCurrentShield() == 0)
            {
                output = 0;
            }

            /*
             * if (card.effectValue[effectIndex] != 0)
             *  output += targetHealthController.GetSimulatedShieldDamage(Mathf.CeilToInt(caster.GetComponent<HealthController>().GetAttack() * card.effectValue[effectIndex] / 100.0f));
             * else if (card.GetTempEffectValue() != 0)
             *  output += targetHealthController.GetSimulatedShieldDamage(Mathf.CeilToInt(caster.GetComponent<HealthController>().GetAttack() * card.GetTempEffectValue() / 100.0f));
             * else
             *  output += targetHealthController.GetSimulatedShieldDamage(caster.GetComponent<HealthController>().GetAttack());
             */
        }
        return(output);
    }
Example #30
0
 public override SimHealthController SimulateProcess(GameObject caster, CardEffectsController effectController, Vector2 location, int value, int duration, SimHealthController simH)
 {
     throw new System.NotImplementedException();
 }