예제 #1
0
        public void AddModifiers(string condition, ClientEffect importObject, int valuePos, int deltaPos)
        {
            string[] condParts = condition.Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries);
            this.modifiers = new ActionModifiers();

            foreach (string cond in condParts)
            {
                if (cond.StartsWith("_race_"))
                {
                    string          race       = cond.Remove(0, 6);
                    SkillTargetRace targetRace = SkillTargetRace.PC_ALL;
                    if (race == "pc_light")
                    {
                        targetRace = SkillTargetRace.ELYOS;
                    }
                    else if (race == "pc_dark")
                    {
                        targetRace = SkillTargetRace.ASMODIANS;
                    }
                    else
                    {
                        targetRace = (SkillTargetRace)Enum.Parse(typeof(SkillTargetRace), race, true);
                    }
                    if (targetRace != SkillTargetRace.PC_ALL)
                    {
                        if (this.modifiers.targetrace == null)
                        {
                            this.modifiers.targetrace = new List <TargetRaceDamageModifier>();
                        }
                        var mod = new TargetRaceDamageModifier();
                        mod.race = targetRace;
                        if (importObject.reserved[valuePos] != null)
                        {
                            mod.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                        }
                        if (importObject.reserved[deltaPos] != null)
                        {
                            mod.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        }
                        this.modifiers.targetrace.Add(mod);
                    }
                }
                else
                {
                    try {
                        TargetState targetState = new NamedEnum <TargetState>(cond);
                        if (targetState == TargetState.BACK)
                        {
                            this.modifiers.backdamage       = new BackDamageModifier();
                            this.modifiers.backdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            this.modifiers.backdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        }
                        else if (targetState == TargetState.FRONT)
                        {
                            this.modifiers.frontdamage       = new FrontDamageModifier();
                            this.modifiers.frontdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            this.modifiers.frontdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        }
                        else if (targetState == TargetState.FLYING)
                        {
                            this.modifiers.flyingdamage = new FlyingDamageModifier();
                            if (importObject.reserved[valuePos] != null)
                            {
                                this.modifiers.flyingdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            }
                            if (importObject.reserved[deltaPos] != null)
                            {
                                this.modifiers.flyingdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                            }
                        }
                        else if (targetState == TargetState.NON_FLYING)
                        {
                            this.modifiers.nonflyingdamage = new NonFlyingDamageModifier();
                            if (importObject.reserved[valuePos] != null)
                            {
                                this.modifiers.nonflyingdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            }
                            if (importObject.reserved[deltaPos] != null)
                            {
                                this.modifiers.nonflyingdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                            }
                        }
                        else
                        {
                            if (this.modifiers.abnormaldamage == null)
                            {
                                this.modifiers.abnormaldamage = new List <AbnormalDamageModifier>();
                            }
                            var abnormaldamage = new AbnormalDamageModifier();
                            abnormaldamage.type = targetState;
                            if (importObject.reserved[valuePos] != null)
                            {
                                abnormaldamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            }
                            if (importObject.reserved[deltaPos] != null)
                            {
                                abnormaldamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                            }
                            this.modifiers.abnormaldamage.Add(abnormaldamage);
                        }
                        if (condParts.Length > 1)
                        {
                            Debug.Print("WARN: More than 1 modifier for skill: {0}", importObject.Skill.id);
                        }
                    } catch {
                        Debug.Print("Modifier '{0}' not handled", cond);
                    }
                }
            }

            if (!this.modifiers.Present)
            {
                this.modifiers = null;
            }
        }
예제 #2
0
        public void AddModifiers(string condition, ClientEffect importObject, int valuePos, int deltaPos)
        {
            string[] condParts = condition.Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries);
            this.modifiers = new ActionModifiers();

            foreach (string cond in condParts) {
                if (cond.StartsWith("_race_")) {
                    string race = cond.Remove(0, 6);
                    SkillTargetRace targetRace = SkillTargetRace.PC_ALL;
                    if (race == "pc_light") {
                        targetRace = SkillTargetRace.ELYOS;
                    } else if (race == "pc_dark") {
                        targetRace = SkillTargetRace.ASMODIANS;
                    } else {
                        targetRace = (SkillTargetRace)Enum.Parse(typeof(SkillTargetRace), race, true);
                    }
                    if (targetRace != SkillTargetRace.PC_ALL) {
                        if (this.modifiers.targetrace == null)
                            this.modifiers.targetrace = new List<TargetRaceDamageModifier>();
                        var mod = new TargetRaceDamageModifier();
                        mod.race = targetRace;
                        if (importObject.reserved[valuePos] != null)
                            mod.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                        if (importObject.reserved[deltaPos] != null)
                            mod.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        this.modifiers.targetrace.Add(mod);
                    }
                } else {
                    try {
                        TargetState targetState = new NamedEnum<TargetState>(cond);
                        if (targetState == TargetState.BACK) {
                            this.modifiers.backdamage = new BackDamageModifier();
                            this.modifiers.backdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            this.modifiers.backdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        } else if (targetState == TargetState.FRONT) {
                            this.modifiers.frontdamage = new FrontDamageModifier();
                            this.modifiers.frontdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            this.modifiers.frontdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        } else if (targetState == TargetState.FLYING) {
                            this.modifiers.flyingdamage = new FlyingDamageModifier();
                            if (importObject.reserved[valuePos] != null)
                                this.modifiers.flyingdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            if (importObject.reserved[deltaPos] != null)
                                this.modifiers.flyingdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        } else if (targetState == TargetState.NON_FLYING) {
                            this.modifiers.nonflyingdamage = new NonFlyingDamageModifier();
                            if (importObject.reserved[valuePos] != null)
                                this.modifiers.nonflyingdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            if (importObject.reserved[deltaPos] != null)
                                this.modifiers.nonflyingdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        } else {
                            if (this.modifiers.abnormaldamage == null)
                                this.modifiers.abnormaldamage = new List<AbnormalDamageModifier>();
                            var abnormaldamage = new AbnormalDamageModifier();
                            abnormaldamage.type = targetState;
                            if (importObject.reserved[valuePos] != null)
                                abnormaldamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            if (importObject.reserved[deltaPos] != null)
                                abnormaldamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                            this.modifiers.abnormaldamage.Add(abnormaldamage);
                        }
                        if (condParts.Length > 1) {
                            Debug.Print("WARN: More than 1 modifier for skill: {0}", importObject.Skill.id);
                        }
                    } catch {
                        Debug.Print("Modifier '{0}' not handled", cond);
                    }
                }
            }

            if (!this.modifiers.Present)
                this.modifiers = null;
        }