Exemple #1
0
        private void DamageCommand(string[] input)
        {
            Character.HealthManager playerHealthMgr = GameObject.FindGameObjectWithTag("Player").GetComponent <Character.HealthManager>();
            Combat.Attack           attack          = null;
            bool canAttack = true;

            if (input.Length <= 2)
            {
                attack = new Combat.Attack(1, false, null);
            }
            else
            {
                int value = 0;
                try
                {
                    value = int.Parse(input[2]);
                }
                catch
                {
                    canAttack = false;
                    string hexColour = ColorUtility.ToHtmlStringRGB(Color.red);
                    DevelopperConsole.AddStaticMessageToConsole($"<color=#{hexColour}>Must put a number or nothing after dmg : {input[2]} </color>");
                }

                if (canAttack)
                {
                    attack = new Combat.Attack(value, false, null);
                }
            }

            if (canAttack)
            {
                playerHealthMgr.OnAttack(null, attack);
            }
        }
Exemple #2
0
 /// <summary>
 /// Changes the displayed text and fades in
 /// </summary>
 /// <param name="textKey"> Text to display </param>
 public void SetKeyAndFadeIn(string textKey)
 {
     if (this.colour != "normal")
     {
         SetColour("normal");
     }
     eventText.SetKey(textKey);
     StartCoroutine(Fade(1));
     displayedAttack = null;
 }
Exemple #3
0
 /// <summary>
 /// Changes the displayed text
 /// </summary>
 /// <param name="textKey"> Localized key for text to display </param>
 public void SetKey(string textKey)
 {
     if (this.colour != "normal")
     {
         SetColour("normal");
     }
     textBackgroundCanvas.alpha = 1;
     eventText.SetKey(textKey);
     displayedAttack = null;
 }
Exemple #4
0
        /// <summary>
        /// Changes the displayed text to show that a partyMember was healed by a healing attack
        /// </summary>
        /// <param name="pm"> PartyMember that was healed </param>
        /// <param name="amount"> Amount that was healed for </param>
        public void SetMHealCritText(Monster m, int amount)
        {
            string healedText = critHealText + " " + LocalizationManager.instance.GetLocalizedValue(m.monsterSpriteName + "_monster") + " " + wasHealedForText + " <color=#EA323C>" + amount.ToString() + " " + HPText;

            eventText.SetText(healedText);
            displayedAttack = null;

            if (this.colour != "normal")
            {
                SetColour("normal");
            }
        }
Exemple #5
0
        /// <summary>
        /// Changes the displayed text to show that a partyMember recovered MP by a focus attack
        /// </summary>
        /// <param name="pm"> PartyMember that was healed </param>
        /// <param name="amount"> Amount of MP recovered </param>
        public void SetPMFocusCritText(PartyMember pm, int amount)
        {
            string focusText = critHealText + " " + pm.pmName + " " + restoredText + " <color=#502BFF>" + amount.ToString() + " " + MPText;

            eventText.SetText(focusText);
            displayedAttack = null;

            if (this.colour != "normal")
            {
                SetColour("normal");
            }
        }
Exemple #6
0
        /// <summary>
        /// Changes the displayed text to show that a partyMember was healed by a healing attack
        /// </summary>
        /// <param name="pm"> PartyMember that was healed </param>
        /// <param name="amount"> Amount that was healed for </param>
        public void SetPMHealCritText(PartyMember pm, int amount)
        {
            string healedText = critHealText + " " + pm.pmName + " " + wasHealedForText + " <color=#EA323C>" + amount.ToString() + " " + HPText;

            eventText.SetText(healedText);
            displayedAttack = null;

            if (this.colour != "normal")
            {
                SetColour("normal");
            }
        }
Exemple #7
0
 /// <summary>
 /// Candle item data
 /// </summary>
 /// <param name="c"></param>
 public ItemData(Candle c)
 {
     this.nameID     = c.nameID;
     this.type       = c.type;
     this.subType    = c.subType;
     this.className  = c.className;
     this.effects    = c.effects;
     this.values     = c.values;
     this.effectsNum = c.effectsNum;
     this.a          = c.a;
     this.uses       = c.uses;
     this.maxUses    = c.maxUses;
 }
Exemple #8
0
        /// <summary>
        /// Sets formula text for an attack
        /// </summary>
        /// <param name="isUsable"> True if usable, false otherwise </param>
        /// <param name="a"> Attack to set formula text to, but may be null if it can be assumed an attack is already being displayed </param>
        public void SetFormulaText(bool isUsable, Attack a = null)
        {
            SetFormulaText(a);

            if (!isUsable)
            {
                SetColour("unusable");
            }
            else
            {
                SetColour("normal");
            }
            textBackgroundCanvas.alpha = 1;
        }
Exemple #9
0
        /// <summary>
        /// Changes the displayed text to show the cost and effects of an attack action
        /// </summary>
        /// <param name="pm"> partyMember object </param>
        /// <param name="isUsable"> True if usable, false otherwise </param>
        public void SetAttackText(Attack a, bool isUsable)
        {
            SetAttackText(a);

            if (!isUsable)
            {
                SetColour("unusable");
            }
            else
            {
                SetColour("normal");
            }
            textBackgroundCanvas.alpha = 1;
        }
Exemple #10
0
        /// <summary>
        /// Changes the displayed text to show that a partyMember dodged the attack
        /// </summary>
        /// <param name="pm"> PartyMember that dodged the attack </param>
        public void SetPMDodgeText(PartyMember pm)
        {
            string dodgedString = pm.pmName + " " + dodgedText;

            if (appendMode == false)
            {
                eventText.SetText(dodgedString);
            }
            else
            {
                eventText.AppendText("\n" + dodgedString);
            }
            displayedAttack            = null;
            textBackgroundCanvas.alpha = 1;
        }
Exemple #11
0
        /// <summary>
        /// Candle item constructor
        /// </summary>
        /// <param name="nameID"> Name of the candle </param>
        /// <param name="type"> Type will always be "candle" for candles </param>
        /// <param name="subType"> subTypes don't matter for candles </param>
        /// <param name="className"> classes that can use this candle (normally any) </param>
        /// <param name="a"> Attack that can be used by equipping candle </param>
        /// <param name="effects"> Effects array </param>
        /// <param name="values"> Values array </param>
        /// <returns> Candle constructor </returns>
        /// <remarks>
        /// Candles will always have 3 effects, with little to no randomization.
        /// 1st effect is a positive effect, 2nd effect is empty, but the 2nd value represents
        /// the number of uses the candle gets, and final effect is the negative effect assocaited with keeping the candle active.
        /// </remarks>
        public Candle(string nameID, string type, string subType, string className, Attack a, string[] effects, int[] values) : base(nameID, type, subType)
        {
            this.className = className;
            this.effects   = effects;
            this.values    = values;
            this.a         = a;
            a.nameKey      = nameID + "_use_title";
            itemSprite     = Resources.Load <Sprite>("Sprites/Items/Candles/" + nameID);
            activeSprite   = Resources.Load <Sprite>("Sprites/Items/Candles/" + nameID + "Active");
            usedSprite     = Resources.Load <Sprite>("Sprites/Items/Candles/" + nameID + "Used");

            isUsable = true;
            uses     = values[1];
            maxUses  = uses;
            CalculateWAXValue();
        }
Exemple #12
0
        /// <summary>
        /// Copy constructor
        /// </summary>
        /// <param name="spr"> Sprite to be displayed </param>
        public Candle(Candle c) : base(c.nameID, c.type, c.subType)
        {
            className = c.className;
            effects   = c.effects;
            values    = c.values;
            this.a    = c.a;

            itemSprite   = c.itemSprite;
            activeSprite = c.activeSprite;
            usedSprite   = c.usedSprite;

            isUsable = c.isUsable;
            uses     = values[1];
            maxUses  = uses;
            CalculateWAXValue();
        }
Exemple #13
0
        public Skill(string name, int type, int upgradeSkill, Attack a, byte skillR, byte skillG, byte skillB, byte skillA)
        {
            this.name         = name;
            this.type         = type;
            this.upgradeSkill = upgradeSkill;
            this.a            = a;
            this.skillR       = skillR;
            this.skillG       = skillG;
            this.skillB       = skillB;
            this.skillA       = skillA;
            skillColour       = new Color32(skillR, skillG, skillB, skillA);

            titleKey     = name + "_skill_title";
            subKey       = name + "_skill_sub";
            desKey       = name + "_skill_des";
            skillEnabled = false;
        }
Exemple #14
0
        /// <summary>
        /// Changes the displayed text to show how much damage a partyMember took from a critical hit
        /// </summary>
        /// <param name="pm"> partyMember object </param>
        /// <param name="amount"> Positive int amount </param>
        public void SetPMDamageCritText(PartyMember pm, int amount)
        {
            string damagedText = critHitText + " " + pm.pmName + " " + lostText + " <color=#EA323C>" + amount.ToString() + " " + HPText + "</color>";

            if (appendMode == false)
            {
                eventText.SetText(damagedText);
            }
            else
            {
                eventText.AppendText("\n" + damagedText);
            }
            displayedAttack = null;

            if (this.colour != "normal")
            {
                SetColour("normal");
            }
        }
Exemple #15
0
        /// <summary>
        /// Set isOpen to false on disabling so relevant interactions don't happen
        /// </summary>
        void OnDisable()
        {
            isOpen = false;

            if (actionsPanel.selectedAction != null)
            {
                Attack selectedAttack = actionsPanel.selectedAction.a;
                if (selectedAttack != null)
                {
                    if (selectedAttack.type == AttackConstants.HEALHP)
                    {
                        SetBlinkSelectables(selectedAttack, true);
                    }
                    else
                    {
                        SetBlinkSelectables(selectedAttack, false);
                    }
                }
            }
        }
Exemple #16
0
        public bool isOpen = false;                                         /// <value> Flag for if panel is being displayed </value>

        /// <summary>
        /// Update the partyPanel with relevant information and visuals when opened
        /// </summary>
        void OnEnable()
        {
            isOpen = true;
            Init(PartyManager.instance.GetPartyMembers());

            if (actionsPanel.selectedAction != null)
            {
                Attack selectedAttack = actionsPanel.selectedAction.a;
                if (selectedAttack != null)
                {
                    if (selectedAttack.type == AttackConstants.HEALHP)
                    {
                        SetBlinkSelectables(selectedAttack, true);
                    }
                    else
                    {
                        SetBlinkSelectables(selectedAttack, false);
                    }
                }
            }
        }
Exemple #17
0
        /// <summary>
        /// Data constructor
        /// </summary>
        /// <param name="i"></param>
        /// <returns></returns>
        public Candle(ItemData i) : base(i.nameID, i.type, i.subType)
        {
            className = i.className;
            effects   = i.effects;
            values    = i.values;
            a         = i.a;

            itemSprite   = Resources.Load <Sprite>("Sprites/Items/Candles/" + nameID);
            activeSprite = Resources.Load <Sprite>("Sprites/Items/Candles/" + nameID + "Active");
            usedSprite   = Resources.Load <Sprite>("Sprites/Items/Candles/" + nameID + "Used");

            uses    = i.uses;
            maxUses = i.maxUses;
            if (i.uses > 0)
            {
                isUsable = true;
            }
            else
            {
                isUsable = false;
            }
        }
Exemple #18
0
 /// <summary>
 /// Makes all PMDs blink if an attack a partyMember can use on another partyMember
 /// </summary>
 /// <param name="a"> Attack </param>
 /// <param name="value"> True to enable blinking, false to disable </param>
 public void SetBlinkSelectables(Attack a, bool value)
 {
     if (value == true)
     {
         for (int i = 0; i < pmDisplays.Length; i++)
         {
             if (pmDisplays[i].gameObject.activeSelf == true && PartyManager.instance.CheckDeath(i) == false)       // TODO: if an attack can target dead partyMembers, use a different function
             {
                 pmDisplays[i].PlaySelectMeAnimation(true);
             }
         }
     }
     else
     {
         for (int i = 0; i < pmDisplays.Length; i++)
         {
             if (pmDisplays[i].gameObject.activeSelf == true && PartyManager.instance.CheckDeath(i) == false)       // TODO: if an attack can target dead partyMembers, use a different function
             {
                 pmDisplays[i].PlaySelectMeAnimation(false);
             }
         }
     }
 }
Exemple #19
0
        /// <summary>
        /// Sets the attack text, but maintains the original usability colouring
        /// (Only used when swapping between formulaText and attackText, as usability doesn't change betwene those)
        /// </summary>
        /// <param name="a"></param>
        public void SetAttackText(Attack a)
        {
            string attackString;
            string costString;

            if (a.costType == "MP")
            {
                costString = "<color=#502BFF>" + a.costValue + " " + a.costType + "</color>";
            }
            else
            {
                costString = "<color=#EA323C>" + a.costValue + " " + a.costType + "</color>";
            }

            if (a.type == AttackConstants.BUFF || a.type == AttackConstants.DEBUFF)
            {
                attackString = costString;
            }
            else if (a.type == AttackConstants.HEALHP)
            {
                attackString = costString + " " + healText + " " + a.attackValue + " " + HPText;
            }
            else if (a.type == AttackConstants.SUMMON)
            {
                attackString = costString + " " + summonText + " " + LocalizationManager.instance.GetLocalizedValue(a.nameKey + "_des");
            }
            else    // physical or magical attack
            {
                attackString = costString + " " + a.attackValue + " " + a.type + " " + damageText;
            }

            if (a.seName != StatusEffectConstant.NONE)
            {
                if (a.seDuration == 1)
                {
                    attackString += ", " + a.seChance + "% chance to " + a.seNameValue + " for " + a.seDuration + " turn on hit";
                }
                else
                {
                    attackString += ", " + a.seChance + "% chance to " + a.seNameValue + " for " + a.seDuration + " turns on hit";
                }
            }
            if (a.scope != (int)AttackConstants.AttackScopes.single)
            {
                if (a.scope == (int)AttackConstants.AttackScopes.adjacent)
                {
                    if (a.seName != StatusEffectConstant.NONE)
                    {
                        attackString += ",\nhits adjacents";
                    }
                    else
                    {
                        attackString += ", hits adjacents";
                    }
                }
                else if (a.scope == (int)AttackConstants.AttackScopes.allMonsters)
                {
                    if (a.seName != StatusEffectConstant.NONE)
                    {
                        attackString += ",\nhits all monsters";
                    }
                    else
                    {
                        attackString += ", hits all monsters";
                    }
                }
            }

            displayedAttack = a;
            eventText.SetText(attackString);
        }
Exemple #20
0
        /// <summary>
        /// Sets formula text, but doesn't change usability colouring
        /// </summary>
        /// <param name="a"> Attack to set formula text to, but may be null if it can be assumed an attack is already being displayed </param>
        public void SetFormulaText(Attack a = null)
        {
            if (a != null)
            {
                displayedAttack = a;
            }
            string formulaString;

            if (displayedAttack.costType == "MP")
            {
                formulaString = "<color=#502BFF>" + displayedAttack.costFormula + " " + displayedAttack.costType + "</color>";
            }
            else
            {
                formulaString = "<color=#EA323C>" + displayedAttack.costFormula + " " + displayedAttack.costType + "</color>";
            }

            if (displayedAttack.type == AttackConstants.BUFF || displayedAttack.type == AttackConstants.DEBUFF)
            {
            }
            else if (displayedAttack.type == AttackConstants.HEALHP)
            {
                formulaString += " " + healText + " " + displayedAttack.damageFormula + " " + HPText;
            }
            else if (displayedAttack.type == AttackConstants.SUMMON)
            {
                formulaString += " " + summonText + " " + LocalizationManager.instance.GetLocalizedValue(displayedAttack.nameKey + "_des");
            }
            else    // physical or magical attack
            {
                formulaString += " " + displayedAttack.damageFormula + " " + displayedAttack.type + " " + damageText;
            }

            if (displayedAttack.seName != StatusEffectConstant.NONE)
            {
                if (displayedAttack.seDuration == 1)
                {
                    formulaString += ", " + displayedAttack.seChance + "% chance to " + displayedAttack.seNameValue + " for " + displayedAttack.seDuration + " turn on hit";
                }
                else
                {
                    formulaString += ", " + displayedAttack.seChance + "% chance to " + displayedAttack.seNameValue + " for " + displayedAttack.seDuration + " turns on hit";
                }
            }
            if (displayedAttack.scope != (int)AttackConstants.AttackScopes.single)
            {
                if (displayedAttack.scope == (int)AttackConstants.AttackScopes.adjacent)
                {
                    if (displayedAttack.seName != StatusEffectConstant.NONE)
                    {
                        formulaString += ",\nhits adjacents";
                    }
                    else
                    {
                        formulaString += ", hits adjacents";
                    }
                }
                else if (displayedAttack.scope == (int)AttackConstants.AttackScopes.allMonsters)
                {
                    if (displayedAttack.seName != StatusEffectConstant.NONE)
                    {
                        formulaString += ",\nhits all monsters";
                    }
                    else
                    {
                        formulaString += ", hits all monsters";
                    }
                }
            }

            eventText.SetText(formulaString);
        }
Exemple #21
0
 /// <summary>
 /// Displays text informing the player a partyMember can't do anything on their combat turn
 /// </summary>
 /// <param name="cname"></param>
 public void SetNoMoveTextPM(string pmname)
 {
     eventText.SetText(pmname + " " + noMoveText);
     textBackgroundCanvas.alpha = 1;
     displayedAttack            = null;
 }
Exemple #22
0
 /// <summary>
 /// Displays text informing the player a monster can't do anything on their combat turn
 /// </summary>
 /// <param name="cname"></param>
 public void SetNoMoveTextM(string mname)
 {
     eventText.SetText(LocalizationManager.instance.GetLocalizedValue(mname + "_monster") + " " + noMoveText);
     textBackgroundCanvas.alpha = 1;
     displayedAttack            = null;
 }
Exemple #23
0
        private bool appendMode = false;                                                                         /// <value> true to append </value>

        /// <summary>
        /// Awake to set displayedattack to null (so unity doesn't do its fake null setting)
        /// </summary>
        void Awake()
        {
            displayedAttack = null;
        }