Beispiel #1
0
 private void TryCountdownDuration(SkillComponentTag skillComponent)
 {
     if (compIntStatus.ContainsKey(skillComponent))
     {
         compIntStatus[skillComponent].Duration -= reduceDuration;
     }
 }
Beispiel #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();
        }
Beispiel #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());
        }
Beispiel #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);
                }
            }
        }
Beispiel #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);
        }
Beispiel #6
0
        public void AddStatus(SkillComponentTag skillComponentTag,
                              EffectData effectData)
        {
            TryMergeStatus(skillComponentTag, effectData);
            TryNegateStatus();
            SetMaxPowerDuration();

            PublishPCStatus();
        }
Beispiel #7
0
 public string GetBuildingEffectName(SkillComponentTag skillComponentTag,
                                     int powerDuration)
 {
     if (HideSkillPower(skillComponentTag))
     {
         return("T X " + powerDuration);
     }
     return(powerDuration + " X " + powerDuration);
 }
Beispiel #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);
 }
Beispiel #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();
 }
Beispiel #10
0
 public bool HasStatus(SkillComponentTag skillComponentTag,
                       out EffectData effectData)
 {
     if (compIntStatus.TryGetValue(skillComponentTag, out effectData))
     {
         return(true);
     }
     effectData = null;
     return(false);
 }
Beispiel #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));
        }
Beispiel #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);
 }
Beispiel #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);
        }
Beispiel #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;
     }
 }
Beispiel #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);
            }
        }
Beispiel #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;
            }
        }
Beispiel #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;
        }
Beispiel #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);
            }
        }
Beispiel #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);
            }
        }
Beispiel #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);
            }
        }
Beispiel #21
0
        public void RemoveStatus(SkillComponentTag skillComponentTag)
        {
            compIntStatus.Remove(skillComponentTag);

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