// -------------------------------------------------------------------------------
 // RefreshCurative
 // -------------------------------------------------------------------------------
 public void RefreshCurative(TemplateAdvanced tmpl)
 {
     RefreshEffects(tmpl);
     if (tmpl.recoveryType != RecoveryType.None)
     {
         contentText.text += Finder.txt.skillVocabulary.recoveryType + " " + tmpl.recoveryType.ToString() + "\n";
     }
 }
Пример #2
0
        // -------------------------------------------------------------------------------
        // DamageTargets
        // -------------------------------------------------------------------------------
        public static void DamageTargets(CharacterBase source, InstanceBase activator, int amount, CharacterBase[] targets)
        {
            foreach (CharacterBase target in targets)
            {
                if (target != null)
                {
                    int level = 0;

                    int accuracy = 0;
                    TemplateAdvanced template = null;

                    if (activator is InstanceItem)
                    {
                        template = ((InstanceItem)activator).template;
                        //level = ((InstanceItem)activator).level;
                    }
                    else if (activator is InstanceSkill)
                    {
                        template = ((InstanceSkill)activator).template;
                        level    = ((InstanceSkill)activator).level;
                    }

                    amount += template.CalculatedEffect(source, target, level);

                    if (source != null)
                    {
                        accuracy = source.stats.Accuracy;
                    }

                    amount = RPGHelper.CalculateFinalDamage(amount, template.attackType, template.element, target);

                    if (source != null)
                    {
                        amount += source.CalculateHitType(amount, target, template);
                    }

                    target.InflictBuffs(template.useBuffType, accuracy, false, template.removeBuff);

                    if (target.parent != null && template.hitEffect != null)
                    {
                        Finder.fx.SpawnEffect(target.parent.transform, template.hitEffect);
                    }

                    amount = target.InflictDamage(amount);

                    Finder.log.Add(string.Format("{0} {1} {2} {3}", target.Name, Finder.txt.actionNames.takes, amount, Finder.txt.basicVocabulary.damage));
                }
            }
        }
        // -------------------------------------------------------------------------------
        // RefreshSpecial
        // -------------------------------------------------------------------------------
        public void RefreshSpecial(TemplateAdvanced tmpl)
        {
            var text = "";

            switch (tmpl.useEffectType)
            {
            case SpecialActionType.PlayerExitBattle:
                text = Finder.txt.specialItemDescriptions.PlayerExitBattle;
                break;

            case SpecialActionType.PlayerExitDungeon:
                text = Finder.txt.specialItemDescriptions.PlayerExitDungeon;
                break;

            case SpecialActionType.PlayerWarpDungeon:
                text = Finder.txt.specialItemDescriptions.PlayerWarpDungeon;
                break;
            }

            contentText.text += text + "\n";
        }
        // -------------------------------------------------------------------------------
        // RefreshClasses
        // -------------------------------------------------------------------------------
        public void RefreshClasses(TemplateAdvanced tmpl)
        {
            foreach (Transform t in ClassContent)
            {
                Destroy(t.gameObject);
            }

            foreach (KeyValuePair <string, TemplateCharacterClass> entry in DictionaryCharacterClass.dict)
            {
                GameObject newObj = (GameObject)Instantiate(ButtonIconPrefab, ClassContent);
                newObj.GetComponentInChildren <Button>().GetComponentInChildren <Image>().sprite = entry.Value.icon;
                newObj.GetComponentInChildren <Button>().interactable = false;
                if (tmpl.characterClasses != null && tmpl.characterClasses.Length > 0)
                {
                    newObj.GetComponentInChildren <Button>().interactable = tmpl.characterClasses.Any(x => x.name == entry.Key);
                }
                else if (tmpl.characterClasses.Length == 0)
                {
                    newObj.GetComponentInChildren <Button>().interactable = true;
                }
            }
        }
 // -------------------------------------------------------------------------------
 // RefreshAttack
 // -------------------------------------------------------------------------------
 public void RefreshAttack(TemplateAdvanced tmpl)  
 {
     RefreshEffects(tmpl);
     contentText.text += Finder.txt.skillVocabulary.attackType + " " + tmpl.attackType.ToString() + "\n";
     RefreshElements(tmpl.element);
 }
        // -------------------------------------------------------------------------------
        // RefreshEffects
        // -------------------------------------------------------------------------------
        public void RefreshEffects(TemplateAdvanced tmpl)
        {
            var text = "";

            text += "<b>" + Finder.txt.basicVocabulary.effects + Finder.txt.seperators.colon + "</b>\n";

            if (tmpl is TemplateSkill)
            {
                text += Finder.txt.skillVocabulary.manaCost + " " + ((TemplateSkill)tmpl).baseManaCost + " + " + ((TemplateSkill)tmpl).bonusManaCost + " " + Finder.txt.skillVocabulary.perLevel + "\n";
            }

            // -- Base Power

            if (tmpl.basePower != 0)
            {
                text += Finder.txt.skillVocabulary.basePower + " " + tmpl.basePower;
            }

            if (tmpl.basePowerPercentage != 0)
            {
                if (tmpl.basePower != 0)
                {
                    text += " + ";
                }
                text += tmpl.basePowerPercentage + "%";
            }
            text += "\n";

            // -- Bonus Power (Abilities only)

            if (tmpl is TemplateSkill)
            {
                if (((TemplateSkill)tmpl).bonusPower != 0)
                {
                    text += Finder.txt.skillVocabulary.bonusPower + " ";
                }

                if (((TemplateSkill)tmpl).bonusPower != 0)
                {
                    text += ((TemplateSkill)tmpl).bonusPower;
                }

                // -- Bonus Power Percentage (Curative Abilities only)

                if (tmpl is TemplateSkillCurative)
                {
                    if (((TemplateSkillCurative)tmpl).bonusPowerPercentage != 0)
                    {
                        if (((TemplateSkill)tmpl).bonusPower != 0)
                        {
                            text += " + ";
                        }
                        text += ((TemplateSkill)tmpl).bonusPowerPercentage + "%";
                    }
                    text += "\n";
                }
            }

            if (tmpl.baseStat != null && tmpl.statPower != 0)
            {
                text += Finder.txt.skillVocabulary.statInfluence + Finder.txt.seperators.colon + tmpl.baseStat.fullName + "\n";
                text += Finder.txt.skillVocabulary.statPower + Finder.txt.seperators.colon + (tmpl.statPower * 100).ToString() + "%\n";
            }

            text += Finder.txt.skillVocabulary.useType + Finder.txt.seperators.colon + Finder.txt.getUseTypeDescription(tmpl.useType) + "\n";
            text += Finder.txt.skillVocabulary.useLocation + Finder.txt.seperators.colon + Finder.txt.getLocationTypeDescription(tmpl.useLocation) + "\n";
            text += Finder.txt.skillVocabulary.useTarget + Finder.txt.seperators.colon + Finder.txt.getTargetTypeDescription(tmpl.targetType) + "\n";

            if (!string.IsNullOrEmpty(text))
            {
                contentText.text += text + "\n";
            }
        }
 // -------------------------------------------------------------------------------
 // RefreshAdvanced
 // -------------------------------------------------------------------------------
 public void RefreshAdvanced(TemplateAdvanced tmpl)  
 {
     contentText.text += tmpl.statRequirements.GetDescription();
 }
Пример #8
0
        // -------------------------------------------------------------------------------
        // RecoverTargets
        // -------------------------------------------------------------------------------
        public static void RecoverTargets(CharacterBase source, InstanceBase activator, int amount, CharacterBase[] targets)
        {
            foreach (CharacterBase target in targets)
            {
                if (target != null)
                {
                    int              level       = 0;
                    int              accuracy    = 0;
                    string           text_before = "";
                    string           text_after  = "";
                    TemplateAdvanced template    = null;

                    if (activator is InstanceItem)
                    {
                        template = ((InstanceItem)activator).template;
                        //level = ((InstanceItem)activator).level;
                    }
                    else if (activator is InstanceSkill)
                    {
                        template = ((InstanceSkill)activator).template;
                        level    = ((InstanceSkill)activator).level;
                    }

                    amount = template.CalculatedEffect(source, target, level);

                    if (target.parent != null && template.hitEffect != null)
                    {
                        Finder.fx.SpawnEffect(target.parent.transform, template.hitEffect);
                    }

                    if (source != null)
                    {
                        accuracy = source.stats.Accuracy;
                    }

                    target.InflictBuffs(template.useBuffType, accuracy, true, template.removeBuff);

                    // -- Apply Stat Boost
                    if (template.recoveryStat != null)
                    {
                        CharacterAttribute attrib = target.stats.attributes.FirstOrDefault(x => x.template == template.recoveryStat);
                        if (attrib != null)
                        {
                            attrib.value += amount;
                        }
                        Finder.log.Add(string.Format("{0} {1} {2} {3}", target.Name, Finder.txt.actionNames.gained, amount, template.recoveryStat.fullName));
                    }

                    // -- Apply Recovery
                    switch (template.recoveryType)
                    {
                    case RecoveryType.HP:
                        amount      = target.RestoreHP(amount);
                        text_before = Finder.txt.actionNames.recovered;
                        text_after  = Finder.txt.basicDerivedStatNames.HP;
                        break;

                    case RecoveryType.MP:
                        amount      = target.RestoreMP(amount);
                        text_before = Finder.txt.actionNames.recovered;
                        text_after  = Finder.txt.basicDerivedStatNames.MP;
                        break;

                    case RecoveryType.HPandMP:
                        target.RestoreMP(amount);
                        amount      = target.RestoreHP(amount);
                        text_before = Finder.txt.actionNames.recovered;
                        text_after  = Finder.txt.basicDerivedStatNames.HP + " & " + Finder.txt.basicDerivedStatNames.MP;
                        break;

                    case RecoveryType.XP:
                        target.XP  += amount;
                        text_before = Finder.txt.actionNames.gained;
                        text_after  = Finder.txt.basicDerivedStatNames.XP;
                        break;
                    }

                    if (template.recoveryType != RecoveryType.None)
                    {
                        Finder.log.Add(string.Format("{0} {1} {2} {3}", target.Name, text_before, amount, text_after));
                    }
                }
            }
        }