Ejemplo n.º 1
0
    public void applyStatusEffects()
    {
        cancelOutStatusEffects();

        int damageOrHeal = 0;

        for (int i = 0; i < statusEffects.Count; i++)
        {
            statusEffect s = statusEffects[i];

            if (s.St == statusEffecttype.healing)
            {
                damageOrHeal -= s.Val;
            }
            if (s.St == statusEffecttype.poisoned)
            {
                damageOrHeal += s.Val;
                //PosionImage.color = new Color(255f, 0f, 255f);
            }

            s.Rounds--;

            if (s.Rounds <= 0)
            {
                statusEffects.RemoveAt(i);
                i--;
                continue;
            }
        }

        takeDamage(damageOrHeal);
    }
Ejemplo n.º 2
0
    public IEnumerator posionEffekt(Image posionimg, statusEffect ss)
    {
        yield return(new WaitForSeconds(1f));

        GameManager.Instance.getOtherPlayer(GameManager.Instance.CurrentPlayerTurn).
        setStatusEffectColors();
        //GameManager.Instance.getOtherPlayer(GameManager.Instance.CurrentPlayerTurn).applyStatusEffects();
        // line above should be
        //Gamemanager.Instance.Getotherplayer(currentplayer).hpvis.whitebox = new Color(255f, 0f, 255f);
    }
Ejemplo n.º 3
0
    // In Prototype 1, Cocoon reduces the damage taken by the player by 50% for 3 turns but prevents
    // attacking for 1 turn.
    IEnumerator SpecialMoveCocoon(Action <bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage("You prepare a strong defence.", 1f));

        statusEffect se = new statusEffect("Cocoon", true, false, 3, false);

        battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return(new WaitForSeconds(2));

        Finish(false, false);
    }
Ejemplo n.º 4
0
 public void playerStatusChange(int playerid, statusEffect status)
 {
     if (playerid == 0)
     {
         player1.status = status;
         //print("Player Hexed status : "+player1.status.blnHexed);
     }
     else
     {
         player2.status = status;
         //print("Player Hexed status : "+player2.status.blnHexed);
     }
 }
Ejemplo n.º 5
0
    // In Prototype 1, Reckless increases the player's damage by 100% for one turn and applies a
    // debuff to the player that increases the enemy's damage by 60% for two turns.
    IEnumerator SpecialMoveReckless(Action <bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage("You launch a wild assault!", 1f));

        float damage = 2f * CalculateStandardDamage(singleAttackTarget);

        statusEffect se = new statusEffect("Reckless", true, false, 2, true);

        battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return(new WaitForSeconds(2));

        StartCoroutine(DealDamage(damage, Finish));
    }
Ejemplo n.º 6
0
    //applies a permanent debuff to the player, which allows the use of DoubleAttack
    IEnumerator Toxin(Action<bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage(
            "The enemy releases shapeshifter toxin into the air.", 1f));

        statusEffect se = new statusEffect("Shapeshifter Toxin", false, false, 0, true);

        GameObject player = GameObject.FindWithTag("Player");
        singleAttackTarget = player.transform.parent.gameObject.GetComponent<Battler>();
        singleAttackTarget.battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return new WaitForSeconds(2);

        Finish(false, false);
    }
Ejemplo n.º 7
0
    //applies a permanent debuff to the player, which allows the use of DoubleAttack
    IEnumerator Toxin(Action <bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage(
                           "[name]: Let's see if you can keep up with me after you breathe in my poison. Mwuhahaha!", 2f));

        statusEffect se = new statusEffect("Shapeshifter Toxin", false, false, 0, true);

        GameObject player = GameObject.FindWithTag("Player");

        singleAttackTarget = player.transform.parent.gameObject.GetComponent <Battler>();
        singleAttackTarget.battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return(new WaitForSeconds(2));

        Finish(false, false);
    }
Ejemplo n.º 8
0
    //applies a permanent debuff to the player, which allows the use of DoubleAttack
    IEnumerator Toxin(Action <bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage(
                           "The enemy releases shapeshifter toxin into the air.", 1f));

        statusEffect se = new statusEffect("Shapeshifter Toxin", false, false, 0, true);

        GameObject player = GameObject.FindWithTag("Player");

        singleAttackTarget = player.transform.parent.gameObject.GetComponent <Battler>();
        singleAttackTarget.battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return(new WaitForSeconds(2));

        Finish(false, false);
    }
Ejemplo n.º 9
0
    public void cancelOutStatusEffects()
    {
        while (true)
        {
            statusEffect hasHeal   = statusEffects.Find(x => x.St == statusEffecttype.healing);
            statusEffect hasPoison = statusEffects.Find(x => x.St == statusEffecttype.poisoned);

            if (hasHeal != null && hasPoison != null)
            {
                statusEffects.Remove(hasHeal);
                statusEffects.Remove(hasPoison);
                clearStatusEffects();
                continue;
            }

            break;
        }
    }
Ejemplo n.º 10
0
    //increases hp by 25% of max hp, but causes double damage to be taken next turn
    IEnumerator Heal(Action<bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage(
            "The enemy momentarily lowers their guard to heal.", 1f));

        statusEffect se = new statusEffect("Shapeshifter Vulnerability", true, false, 1, true);
        battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return new WaitForSeconds(2);

        battleState.currentHealth += (int)(0.35f * battleState.maximumHealth);

        StartCoroutine(CombatUI.Instance.UpdateHealthBar((double)battleState.currentHealth,
                (double)battleState.maximumHealth, false));

        Finish(false, false);
    }
Ejemplo n.º 11
0
    //increases hp by 25% of max hp, but causes double damage to be taken next turn
    IEnumerator Heal(Action <bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage(
                           "The enemy momentarily lowers their guard to heal.", 1f));

        statusEffect se = new statusEffect("Shapeshifter Vulnerability", true, false, 1, true);

        battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return(new WaitForSeconds(2));

        battleState.currentHealth += (int)(0.2f * battleState.maximumHealth);

        StartCoroutine(CombatUI.Instance.UpdateHealthBar((double)battleState.currentHealth,
                                                         (double)battleState.maximumHealth, false));

        Finish(false, false);
    }
Ejemplo n.º 12
0
    public void setStatusEffectColors()
    {
        cancelOutStatusEffects();
        int l = 0;

        for (int i = 0; i < statusEffects.Count; i++)
        {
            statusEffect s = statusEffects[i];

            if (s.St == statusEffecttype.healing)
            {
                l = -s.Val * s.Rounds;
            }
            if (s.St == statusEffecttype.poisoned)
            {
                l = s.Val * s.Rounds;
            }
        }

        hpvis.EffectAmount = l;
    }
Ejemplo n.º 13
0
    //applies a permanent debuff to the player, which allows the use of DoubleAttack
    IEnumerator Toxin(Action<bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage(
            "[name]: Let's see if you can keep up with me after you breathe in my poison. Mwuhahaha!", 2f));

        statusEffect se = new statusEffect("Shapeshifter Toxin", false, false, 0, true);

        GameObject player = GameObject.FindWithTag("Player");
        singleAttackTarget = player.transform.parent.gameObject.GetComponent<Battler>();
        singleAttackTarget.battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return new WaitForSeconds(2);

        Finish(false, false);
    }
Ejemplo n.º 14
0
    public IEnumerator PlaySpellCard(string spell)
    {
        var gm = GameManager.Instance;

        switch (spell)
        {
        case "Swap":
            Debug.Log("starting swap");
            yield return(StartCoroutine(gm.selectionManager.getSelectionWithPlayers(2)));

            Debug.Log(gm.selectionManager.points.Count);
            if (gm.selectionManager.points.Count == 2)
            {
                AudioManager.instance.PlaySound("DealCard");
                boardManager.SwapCard(gm.selectionManager.points[0], gm.selectionManager.points[1]);
                BoardManager.Instance.UpdateCards();
            }
            else
            {
                Debug.Log("cancled");
            }
            break;

        case "Rotate":

            Debug.Log("starting rotate");

            yield return(StartCoroutine(gm.selectionManager.getSelectionWithPlayers(1)));

            if (gm.selectionManager.points.Count == 1)
            {
                Debug.Log("here");
                AudioManager.instance.PlaySound("RotateSpellCard");
                boardManager.RotateArrows(gm.selectionManager.points[0]);
                BoardManager.Instance.UpdateCards();
            }
            else
            {
                Debug.Log("cancled");
            }
            break;

        case "Replace2":

            yield return(StartCoroutine(gm.selectionManager.getSelectionNoPlayers(2)));

            if (gm.selectionManager.points.Count == 2)
            {
                AudioManager.instance.PlaySound("DealCard");
                boardManager.Replace2(gm.selectionManager.points[0], gm.selectionManager.points[1]);
                BoardManager.Instance.UpdateCards();
            }
            else
            {
                Debug.Log("cancled");
            }
            break;

        case "Poison":
            AudioManager.instance.PlaySound("Poison");
            //GameManager.Instance.getOtherPlayer(this).takeDamage(5) ;
            Vector3 ApLocation = boardManager.transform.position;
            //GameManager.Instance.getOtherPlayer(this).takeDamage(2);
            statusEffect st = new statusEffect(statusEffecttype.poisoned, 4, 2);
            GameManager.Instance.getOtherPlayer(this).statusEffects.Add(st);

            DamageEffect d = new DamageEffect();
            d.CreatePoisonEffect(PosionEff, handvisual.PlayPreviewSpot.transform.position, GameManager.Instance.getOtherPlayer(GameManager.Instance.CurrentPlayerTurn).hpvis.Box.transform.position);
            StartCoroutine(posionEffekt(PosionImage, st));
            break;

        case "Damage":
            AudioManager.instance.PlaySound("DamageSpellCard");
            Vector3      ApLocation2 = boardManager.transform.position;
            DamageEffect ddd         = new DamageEffect();
            ddd.CreatePoisonEffect(PosionEff, handvisual.PlayPreviewSpot.transform.position, GameManager.Instance.getOtherPlayer(GameManager.Instance.CurrentPlayerTurn).hpvis.Box.transform.position);
            StartCoroutine(damageEffekt());
            break;

        case "Health":
            AudioManager.instance.PlaySound("HealSpellCard");
            DamageEffect dd = new DamageEffect();
            dd.CreatePotionEffect(PotionEff, handvisual.PlayPreviewSpot.transform.position, GameManager.Instance.CurrentPlayerTurn.hpvis.Box.transform.position);
            StartCoroutine(healingEffekt());
            break;

        case "Potion":
            AudioManager.instance.PlaySound("Potion");
            //GameManager.Instance.CurrentPlayerTurn.Hp += 5;
            statusEffect st2 = new statusEffect(statusEffecttype.healing, 3, 2);
            statusEffects.Add(st2);

            DamageEffect dddd = new DamageEffect();
            dddd.CreatePotionEffect(PotionEff, handvisual.PlayPreviewSpot.transform.position, GameManager.Instance.CurrentPlayerTurn.hpvis.Box.transform.position);
            StartCoroutine(potionEffekt(PotionImage, st2));
            break;

        case "Boost":
            AudioManager.instance.PlaySound("BoostSpellCard");
            Debug.Log("Boost");
            ActionPoints++;
            BoardManager.Instance.UpdateCards();
            break;
        }
        Debug.Log("update cards");


        yield return(new WaitForSeconds(0.1f));

        GameManager.Instance.EnableInputs();
    }
Ejemplo n.º 15
0
    public IEnumerator potionEffekt(Image posionimg, statusEffect ss)
    {
        yield return(new WaitForSeconds(1f));

        GameManager.Instance.CurrentPlayerTurn.setStatusEffectColors();
    }
Ejemplo n.º 16
0
    private void Start()
    {
        status               = new statusEffect();
        status.blnCursed     = false;
        status.blnHexed      = false;
        status.accuracy      = 100;
        status.hexDuration   = -1;
        status.curseDuration = -1;

        GameObject.FindGameObjectWithTag("Goal1").GetComponent <GoalArea>().GameScore = GameScore;
        GameObject.FindGameObjectWithTag("Goal2").GetComponent <GoalArea>().GameScore = GameScore;

        gameMaster = GameObject.Find("GameMaster").GetComponent <GameMaster>();

        if (isLocalPlayer == true)
        {
            GameObject tempViewChange = Instantiate(Resources.Load("ViewChanger") as GameObject);

            tempViewChange.GetComponent <ViewChanger>().SetView(playerID);

            int spellCount = 0;

            foreach (Transform item in spellButtons.transform)
            {
                SpellButton tempSpellButton = item.GetComponent <SpellButton>();

                if (tempSpellButton != null)
                {
                    tempSpellButton.player     = gameObject;
                    tempSpellButton.gameMaster = gameMaster;

                    switch (spellCount)
                    {
                    case 0:
                        tempSpellButton.spell = GetComponent <ProjectileSpell>();
                        break;

                    case 1:
                        tempSpellButton.spell = GetComponent <WallSpell>();
                        break;

                    case 2:
                        tempSpellButton.spell = GetComponent <TornadoSpell>();
                        break;

                    case 3:
                        tempSpellButton.spell = GetComponent <HexSpell>();
                        break;

                    case 4:
                        tempSpellButton.spell = GetComponent <CurseSpell>();
                        break;

                    case 5:
                        tempSpellButton.spell = GetComponent <MonsterSpell>();
                        break;

                    default:
                        break;
                    }

                    spellCount += 1;
                }
            }

            playerCamera.SetActive(true);
        }
        else
        {
            playerCamera.SetActive(false);
        }
    }
Ejemplo n.º 17
0
    void FinishDoingAction(bool deathOccurred, bool speedChanged)
    {
        doingAction = false;

        //reverse iteration over the list so that elements can be removed while iterating
        for (int i = activeBattler.battleState.statusEffects.Count - 1; i >= 0; i--)
        {
            statusEffect se = activeBattler.battleState.statusEffects[i];

            if (se.limitedDuration)
            {
                if (!se.startedDuration)
                {
                    se.startedDuration = true;
                }
                else
                {
                    se.numberOfTurnsRemaining--;

                    if (se.numberOfTurnsRemaining == 0)
                    {
                        activeBattler.battleState.statusEffects.Remove(se);
                    }
                }
            }
        }

        if (deathOccurred)
        {
            GameObject   player  = GameObject.FindWithTag("Player");
            GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");

            if (player == null)
            {
                StartCoroutine(CombatUI.Instance.DisplayBlockingMessage("You've been killed..."));
                lostBattle         = true;
                currentBattlePhase = BattlePhase.BattleEnd;
            }
            else if (enemies.Length == 0)
            {
                StartCoroutine(CombatUI.Instance.DisplayBlockingMessage("You've won the battle!"));
                lostBattle         = false;
                currentBattlePhase = BattlePhase.BattleEnd;
            }
            return;
        }

        activeBattlerIndex++;
        if (activeBattlerIndex < battlers.Length)
        {
            activeBattler = battlers[activeBattlerIndex].GetComponent <Battler>();
        }
        else
        {
            for (int i = 0; i < battlers.Length; i++)
            {
                battlers[i].GetComponent <Battler>().EndRoundAction();
            }

            activeBattlerIndex = 0;
            activeBattler      = battlers[activeBattlerIndex].GetComponent <Battler>();
            currentBattlePhase = BattlePhase.ChooseAction;
        }
    }
Ejemplo n.º 18
0
    // In Prototype 1, Reckless increases the player's damage by 100% for one turn and applies a
    // debuff to the player that increases the enemy's damage by 60% for two turns.
    IEnumerator SpecialMoveReckless(Action<bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage("You launch a wild assault!", 1f));

        float damage = 2f * CalculateStandardDamage(singleAttackTarget);

        statusEffect se = new statusEffect("Reckless", true, false, 2, true);
        battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return new WaitForSeconds(2);

        StartCoroutine(DealDamage(damage, Finish));
    }
Ejemplo n.º 19
0
    // In Prototype 1, Cocoon reduces the damage taken by the player by 50% for 3 turns but prevents
    // attacking for 1 turn.
    IEnumerator SpecialMoveCocoon(Action<bool, bool> Finish)
    {
        StartCoroutine(CombatUI.Instance.DisplayMessage("You prepare a strong defence.", 1f));

        statusEffect se = new statusEffect("Cocoon", true, false, 3, false);
        battleState.statusEffects.Add(se);

        //in place of animations, there is a 2 second wait
        yield return new WaitForSeconds(2);

        Finish(false, false);
    }