Ejemplo n.º 1
0
 private void TryCountdownDuration(SkillComponentTag skillComponent)
 {
     if (compIntStatus.ContainsKey(skillComponent))
     {
         compIntStatus[skillComponent].Duration -= reduceDuration;
     }
 }
Ejemplo n.º 2
0
        private void ActorStatus_EndingTurn(object sender,
                                            StartOrEndTurnEventArgs e)
        {
            SkillComponentTag merit = SkillComponentTag.WaterMerit;
            SkillComponentTag flaw  = SkillComponentTag.FireFlaw;

            if (!GetComponent <LocalManager>().MatchID(e.ObjectID))
            {
                return;
            }

            if (HasStatus(flaw, out _))
            {
                TryCountdownDuration(flaw);
                TryCountdownDuration(positiveStatus);
            }
            else if (HasStatus(merit, out _))
            {
                TryCountdownDuration(merit);
                TryCountdownDuration(negativeStatus);
            }
            else
            {
                TryCountdownDuration(positiveStatus);
                TryCountdownDuration(negativeStatus);
            }
            PublishPCStatus();
        }
Ejemplo n.º 3
0
        private SkillComponentTag[] SortComponents(SkillTypeTag skillTypeTag,
                                                   Dictionary <SkillComponentTag, EffectData> compInt)
        {
            Queue <SkillComponentTag> sortedComp = new Queue <SkillComponentTag>();

            SkillComponentTag[] checkList;

            switch (skillTypeTag)
            {
            case SkillTypeTag.Buff:
                checkList = sortedEnhance;
                break;

            case SkillTypeTag.Curse:
                checkList = sortedCurse;
                break;

            default:
                checkList = new SkillComponentTag[] { };
                break;
            }

            foreach (SkillComponentTag sct in checkList)
            {
                if (compInt.ContainsKey(sct))
                {
                    sortedComp.Enqueue(sct);
                }
            }
            return(sortedComp.ToArray());
        }
Ejemplo n.º 4
0
        private void SkillCooldown_StartedTurn(object sender,
                                               StartOrEndTurnEventArgs e)
        {
            ActorStatus       actorStatus = GetComponent <ActorStatus>();
            SkillComponentTag flaw        = SkillComponentTag.WaterFlaw;
            SkillComponentTag merit       = SkillComponentTag.FireMerit;
            int decrease;
            int cooldown;

            if (!GetComponent <LocalManager>().MatchID(e.ObjectID) ||
                actorStatus.HasStatus(flaw, out _))
            {
                return;
            }

            if (actorStatus.HasStatus(merit, out _))
            {
                decrease = fastDecrease;
            }
            else
            {
                decrease = normalDecrease;
            }

            foreach (SkillNameTag snt in currentCDDict.Keys.ToArray())
            {
                if (currentCDDict[snt] > MinCooldown)
                {
                    cooldown = currentCDDict[snt] - decrease;
                    cooldown = Math.Max(MinCooldown, cooldown);
                    SetCurrentCooldown(snt, cooldown);
                }
            }
        }
Ejemplo n.º 5
0
        public bool TrySetSkillSlot(SkillNameTag skillNameTag,
                                    SkillSlotTag skillSlotTag, SkillComponentTag skillComponentTag)
        {
            SkillTypeTag skillTypeTag = GetComponent <PCSkillManager>()
                                        .GetSkillTypeTag(skillNameTag);
            bool canSetSlot;

            switch (skillSlotTag)
            {
            case SkillSlotTag.Merit1:
            case SkillSlotTag.Merit2:
            case SkillSlotTag.Merit3:
                canSetSlot = VerifyMeritSlot(skillTypeTag, skillComponentTag);
                break;

            case SkillSlotTag.Flaw1:
            case SkillSlotTag.Flaw2:
            case SkillSlotTag.Flaw3:
                canSetSlot = VerifyFlawSlot(skillComponentTag);
                break;

            default:
                canSetSlot = false;
                break;
            }

            if (canSetSlot &&
                slotCompDict.TryGetValue(skillNameTag, out var slotComp))
            {
                slotComp[skillSlotTag] = skillComponentTag;
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        public void AddStatus(SkillComponentTag skillComponentTag,
                              EffectData effectData)
        {
            TryMergeStatus(skillComponentTag, effectData);
            TryNegateStatus();
            SetMaxPowerDuration();

            PublishPCStatus();
        }
Ejemplo n.º 7
0
 public string GetBuildingEffectName(SkillComponentTag skillComponentTag,
                                     int powerDuration)
 {
     if (HideSkillPower(skillComponentTag))
     {
         return("T X " + powerDuration);
     }
     return(powerDuration + " X " + powerDuration);
 }
Ejemplo n.º 8
0
 private bool VerifyMeritSlot(SkillTypeTag skillTypeTag,
                              SkillComponentTag skillComponentTag)
 {
     if (validMeritSlot.TryGetValue(skillTypeTag, out var comp))
     {
         return(Array.Exists(comp, e => e == skillComponentTag));
     }
     return(false);
 }
Ejemplo n.º 9
0
 private void SetTemplateData(SkillNameTag skillName,
                              SkillSlotTag skillSlot, SkillComponentTag skillComponent)
 {
     nameSlotCompDict[skillName][skillSlot] = skillComponent;
     xmlFile
     .Element(skillName.ToString())
     .Element(skillSlot.ToString())
     .Value
         = skillComponent.ToString();
 }
Ejemplo n.º 10
0
 public bool HasStatus(SkillComponentTag skillComponentTag,
                       out EffectData effectData)
 {
     if (compIntStatus.TryGetValue(skillComponentTag, out effectData))
     {
         return(true);
     }
     effectData = null;
     return(false);
 }
Ejemplo n.º 11
0
        private string GetTrapEffectName(SubTag subTag)
        {
            MainTag           mainTag  = MainTag.Trap;
            BuildingEffect    building = GetComponent <BuildingEffect>();
            SkillComponentTag skill    = building.GetEffect(mainTag, subTag);
            int data = building.GetPowerDuration(mainTag, subTag);

            return(GetComponent <ConvertSkillMetaInfo>()
                   .GetBuildingEffectName(skill, data));
        }
Ejemplo n.º 12
0
 public bool ConvertCurse2Flaw(SkillComponentTag curse,
                               out SkillComponentTag flaw)
 {
     if (curse2flaw.TryGetValue(curse, out SkillComponentTag data))
     {
         flaw = data;
         return(true);
     }
     flaw = SkillComponentTag.INVALID;
     return(false);
 }
Ejemplo n.º 13
0
        public string GetSkillEffectName(SkillComponentTag skillComponentTag,
                                         EffectData effectData)
        {
            int power    = effectData.Power;
            int duration = effectData.Duration;

            if (HideSkillPower(skillComponentTag))
            {
                return("T X " + duration);
            }
            return(power + " X " + duration);
        }
Ejemplo n.º 14
0
 private void TryMergeStatus(SkillComponentTag skillComponentTag,
                             EffectData effectData)
 {
     if (compIntStatus.ContainsKey(skillComponentTag))
     {
         compIntStatus[skillComponentTag].Power    += effectData.Power;
         compIntStatus[skillComponentTag].Duration += effectData.Duration;
     }
     else
     {
         compIntStatus[skillComponentTag] = effectData;
     }
 }
Ejemplo n.º 15
0
        private bool VerifyFlawSlot(SkillComponentTag skillComponentTag)
        {
            switch (skillComponentTag)
            {
            case SkillComponentTag.FireFlaw:
            case SkillComponentTag.WaterFlaw:
            case SkillComponentTag.AirFlaw:
            case SkillComponentTag.EarthFlaw:
                return(true);

            default:
                return(false);
            }
        }
Ejemplo n.º 16
0
        private void NPCBonusAction_StartedTurn(object sender,
                                                StartOrEndTurnEventArgs e)
        {
            SkillComponentTag flaw = SkillComponentTag.WaterFlaw;

            if (!GetComponent <LocalManager>().MatchID(e.ObjectID) ||
                GetComponent <ActorStatus>().HasStatus(flaw, out _))
            {
                return;
            }

            if (CurrentCooldown > MinCooldown)
            {
                CurrentCooldown -= decrease;
            }
        }
Ejemplo n.º 17
0
        private void PrintCurse(GameObject target)
        {
            SkillComponentTag curseEffect = target.GetComponent <NPCAttack>()
                                            .CurseEffect;
            int powerDuration = target.GetComponent <NPCAttack>().CurseData;

            if (curseEffect == SkillComponentTag.INVALID)
            {
                return;
            }

            string curseText = GetComponent <SkillData>().GetSkillComponentName(
                curseEffect);
            string curseData = GetComponent <ConvertSkillMetaInfo>()
                               .GetSkillEffectName(curseEffect,
                                                   new EffectData(powerDuration, powerDuration));

            SearchText(UITag.CurseText).text = curseText;
            SearchText(UITag.CurseData).text = curseData;
        }
Ejemplo n.º 18
0
        private void ActiveTrap_EndingTurn(object sender,
                                           StartOrEndTurnEventArgs e)
        {
            if (!GetComponent <LocalManager>().MatchID(e.ObjectID))
            {
                return;
            }

            while (trapTags.Count > 0)
            {
                BuildingEffect building
                    = GameCore.AxeManCore.GetComponent <BuildingEffect>();
                MainTag           mainTag = MainTag.Trap;
                SubTag            subTag  = trapTags.Pop();
                SkillComponentTag skill   = building.GetEffect(mainTag, subTag);
                int data = building.GetPowerDuration(mainTag, subTag);

                GetComponent <ActorStatus>().AddStatus(skill,
                                                       new EffectData(data, data));
                AddLog(subTag);
            }
        }
Ejemplo n.º 19
0
        private string GetAltarEffectName(SubTag subTag)
        {
            MainTag           mainTag  = MainTag.Altar;
            BuildingEffect    building = GetComponent <BuildingEffect>();
            SkillComponentTag skill    = building.GetEffect(mainTag, subTag);
            int data = building.GetPowerDuration(mainTag, subTag);

            switch (subTag)
            {
            case SubTag.FireAltar:
            case SubTag.WaterAltar:
            case SubTag.AirAltar:
            case SubTag.EarthAltar:
                return(GetComponent <ConvertSkillMetaInfo>()
                       .GetBuildingEffectName(skill, data));

            case SubTag.LifeAltar:
                return(data.ToString());

            default:
                return(null);
            }
        }
Ejemplo n.º 20
0
        private bool HideSkillPower(SkillComponentTag skillComponentTag)
        {
            switch (skillComponentTag)
            {
            case SkillComponentTag.FireMerit:
            case SkillComponentTag.FireFlaw:
            case SkillComponentTag.FireCurse:
            case SkillComponentTag.WaterMerit:
            case SkillComponentTag.WaterFlaw:
            case SkillComponentTag.WaterCurse:
                return(true);

            case SkillComponentTag.AirMerit:
            case SkillComponentTag.AirFlaw:
            case SkillComponentTag.AirCurse:
            case SkillComponentTag.EarthMerit:
            case SkillComponentTag.EarthFlaw:
            case SkillComponentTag.EarthCurse:
                return(false);

            default:
                return(false);
            }
        }
Ejemplo n.º 21
0
        public void RemoveStatus(SkillComponentTag skillComponentTag)
        {
            compIntStatus.Remove(skillComponentTag);

            PublishPCStatus();
        }
Ejemplo n.º 22
0
 public bool TrySetSkillSlot(SkillNameTag skillNameTag,
                             SkillSlotTag skillSlotTag, SkillComponentTag skillComponentTag)
 {
     return(GetComponent <SkillSlot>().TrySetSkillSlot(skillNameTag,
                                                       skillSlotTag, skillComponentTag));
 }
Ejemplo n.º 23
0
 public string GetBuildingEffectName(SkillComponentTag skillComponentTag,
                                     int powerDuration)
 {
     return(GameCore.AxeManCore.GetComponent <ConvertSkillMetaInfo>()
            .GetBuildingEffectName(skillComponentTag, powerDuration));
 }
Ejemplo n.º 24
0
 public string GetSkillComponentName(SkillComponentTag skillComponentTag)
 {
     return(GameCore.AxeManCore.GetComponent <SkillData>()
            .GetSkillComponentName(skillComponentTag));
 }
Ejemplo n.º 25
0
 public string GetSkillEffectName(SkillComponentTag skillComponentTag,
                                  EffectData effectData)
 {
     return(GameCore.AxeManCore.GetComponent <ConvertSkillMetaInfo>()
            .GetSkillEffectName(skillComponentTag, effectData));
 }
Ejemplo n.º 26
0
 public string GetSkillComponentName(SkillComponentTag skillComponentTag)
 {
     return(GetStringData(component, skillComponentTag.ToString()));
 }
Ejemplo n.º 27
0
 public string GetSkillComponentDescription(
     SkillComponentTag skillComponentTag)
 {
     return(GetStringData(description, skillComponentTag.ToString()));
 }