Ejemplo n.º 1
0
        /// <summary>
        /// When player eat, receive a specific effect
        /// </summary>
        /// <param name="food">what food are you eating?</param>
        public bool Eating(Food food)
        {
            if (this.Eat)
            {
                if (food.Effect != null)
                {
                    //we look effect on our food and active this.
                    switch (food.Effect)
                    {
                    case RegenerationEffect Regeneration:
                        //food with health effect regenerate the life of characters
                        if (Regeneration.regenerationType == RegenerationType.Health)
                        {
                            Regeneration.RegenerationHealth(this);
                        }
                        break;

                    case SicknessEffect sickness:
                        //sickness.Sickness();
                        break;

                    case BuffEffect buff:
                        //sickness.Sickness();
                        break;
                    }
                }
                this.Eat = false;
                return(true);
            }
            return(false);
        }
        private void SetRegeneration(Creature c, string temp)
        {
            string temp2;

            string[] tempArray;
            temp2 = GetTextUntilTag(temp, "<b>Regeneration</b>");
            if (!String.IsNullOrEmpty(temp2))
            {
                Regeneration rg = new Regeneration();
                rg.Value  = GetIntValue(temp2, null);
                tempArray = temp2.Split(new char[] { ' ' }, 2);
                if (tempArray.Count() == 2)
                {
                    // Draconomicon Metallic Storm Abissai is just "Regeneration 5"
                    rg.Details = tempArray[1].Trim();
                    if (rg.Details.StartsWith("("))
                    {
                        rg.Details = rg.Details.Substring(1);
                    }
                    if (rg.Details.EndsWith(")"))
                    {
                        rg.Details = rg.Details.Substring(0, rg.Details.Length - 1);
                    }
                }
                c.Regeneration = rg;
            }
        }
Ejemplo n.º 3
0
        public RegenerationForm(Regeneration regen)
        {
            InitializeComponent();

            fRegeneration = regen.Copy();

            ValueBox.Value  = fRegeneration.Value;
            DetailsBox.Text = fRegeneration.Details;
        }
Ejemplo n.º 4
0
 private void AreEqual(Regeneration ddi, Regeneration mp)
 {
     if (mp == null)
     {
         Assert.IsNull(ddi);
         return;
     }
     Assert.AreEqual(ddi.Details, mp.Details);
     Assert.AreEqual(ddi.Value, mp.Value);
     Assert.AreEqual(ddi.ToString(), mp.ToString());
 }
 private void AreEqual(Regeneration ddi, Regeneration mp)
 {
     if (mp == null)
     {
         Assert.IsNull(ddi);
         return;
     }
     Assert.AreEqual(ddi.Details, mp.Details);
     Assert.AreEqual(ddi.Value, mp.Value);
     Assert.AreEqual(ddi.ToString(), mp.ToString());
 }
Ejemplo n.º 6
0
    // Constructor
    public NPCParam()
    {
        privateParams = PrivateParam.Default();
        param         = Param.Default();
        abilitys      = Abilitys.Default();
        resistance    = Resistance.Default();
        regeneration  = Regeneration.Default();

        itemInventory  = new ItemInventory(float.MaxValue, float.MaxValue);
        skillInventory = new SkillInventory();
        buffInventory  = new BuffInventory();
    }
Ejemplo n.º 7
0
    private void Awake()
    {
        instance = this;
        //PlayerPrefs.DeleteKey ("SaveTimer");
        string str = PlayerPrefs.GetString("SaveTimer", null);

        //		print (str);
        if (string.IsNullOrEmpty(str) == false)
        {
            string[] strs = str.Split('?');
            // 1 - DateTime
            DateTime recordedDt = Convert.ToDateTime(strs[0]);
            // 2 - lifeAmount
            this.lifeAmount = int.Parse(strs[1]);
            // 3 - maxLifeAmount
            this.maxLifeAmount = int.Parse(strs[2]);
            // 4 - minutesForNewLife
            this.minutesForNewLife = int.Parse(strs[3]);

            int result = DateTime.Compare(recordedDt, DateTime.Now);
            if (result < 0)
            {
                // Full time for life
                this.lifeAmount = this.maxLifeAmount;
                timerText.text  = this.minutesForNewLife.ToString() + ":00";
            }
            else
            {
                // Timer is not over
                TimeSpan ts            = recordedDt - DateTime.Now;
                int      timeRemaining = (int)ts.TotalSeconds;
                int      timeForLife   = (this.minutesForNewLife * 60);

                int remainingTimeForTimer = timeRemaining % timeForLife;
                int removeLife            = (timeRemaining / timeForLife);
                this.lifeAmount = this.maxLifeAmount - removeLife - 1;
                this.next       = DateTime.Now.AddSeconds(remainingTimeForTimer);
            }
        }
        else
        {
            // first time playing
            this.lifeAmount = this.maxLifeAmount = 10;
            int min = this.minutesForNewLife = 20;
            timerText.text = min.ToString() + ":00";
        }
        this.lifeNumberText.text = this.lifeAmount.ToString();


        tempLife = lifeAmount;
    }
Ejemplo n.º 8
0
        public static void UpdateRegen(ICreature c)
        {
            Aura aura = CreatureHelper.FindAura(c, "Regeneration") ?? CreatureHelper.FindAura(c, "Regen");

            if (aura != null)
            {
                Regeneration regeneration = CreatureHelper.ConvertAura(aura.Details);
                if (regeneration != null)
                {
                    c.Regeneration = regeneration;
                    c.Auras.Remove(aura);
                }
            }
        }
Ejemplo n.º 9
0
        public override void OnTick(Level level)
        {
            if (_nextUpdate > level.TickTime)
            {
                return;
            }

            _nextUpdate = level.TickTime + 80;

            if (!HaveSkyLight(level))
            {
                return;
            }

            int pyramidLevels = GetPyramidLevels(level);

            int duration = 180 + pyramidLevels * 40;
            int range    = 10 + pyramidLevels * 10;

            EffectType prim = (EffectType)Primary;
            EffectType sec  = (EffectType)Secondary;

            var effectPrim = GetEffect(prim);

            if (effectPrim != null && pyramidLevels > 0)
            {
                effectPrim.Level     = pyramidLevels == 4 && prim == sec ? 1 : 0;
                effectPrim.Duration  = duration;
                effectPrim.Particles = true;

                var players = level.Players.Where(player => player.Value.IsSpawned && Vector3.Distance(Coordinates, player.Value.KnownPosition) <= range);
                foreach (var player in players)
                {
                    player.Value.SetEffect(effectPrim, true);

                    if (pyramidLevels == 4 && prim != sec)
                    {
                        Regeneration regen = new Regeneration
                        {
                            Level     = 0,
                            Duration  = duration,
                            Particles = true
                        };

                        player.Value.SetEffect(regen);
                    }
                }
            }
        }
Ejemplo n.º 10
0
    public static void SetDefault()
    {
        privateParams = PrivateParam.Default();
        param         = Param.Default();
        abilitys      = Abilitys.Default();
        resistance    = Resistance.Default();
        regeneration  = Regeneration.Default();

        itemInventory       = new ItemInventory(float.MaxValue, float.MaxValue);
        equipInventory      = new EquipInventory();
        skillInventory      = new SkillInventory();
        buffInventory       = new BuffInventory();
        professionInventory = new ProfessionInventory();
        recipeInventory     = new RecipeInventory();
        hotBarInventory     = new HotBarInventory();
    }
Ejemplo n.º 11
0
        private void RegenBtn_Click(object sender, EventArgs e)
        {
            Regeneration regen = fNPC.Regeneration;

            if (regen == null)
            {
                regen = new Regeneration();
            }

            RegenerationForm dlg = new RegenerationForm(regen);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                fNPC.Regeneration = dlg.Regeneration;
            }
        }
Ejemplo n.º 12
0
        public static Regeneration ConvertAura(string aura_details)
        {
            Regeneration regeneration;

            aura_details = aura_details.Trim();
            bool   flag        = true;
            string str         = "";
            string str1        = "";
            string auraDetails = aura_details;

            for (int i = 0; i < auraDetails.Length; i++)
            {
                char chr = auraDetails[i];
                if (!char.IsDigit(chr))
                {
                    flag = false;
                }
                if (!flag)
                {
                    str1 = string.Concat(str1, chr);
                }
                else
                {
                    str = string.Concat(str, chr);
                }
            }
            str1 = str1.Trim();
            if (str1.StartsWith("(") && str1.EndsWith(")"))
            {
                str1 = str1.Substring(1);
                str1 = str1.Substring(0, str1.Length - 1);
                str1.Trim();
            }
            try
            {
                regeneration = new Regeneration((str != "" ? int.Parse(str) : 0), str1);
            }
            catch (Exception exception)
            {
                LogSystem.Trace(exception);
                regeneration = null;
            }
            return(regeneration);
        }
Ejemplo n.º 13
0
        public static void UpdateRegen(ICreature c)
        {
            Aura regen_aura = FindAura(c, "Regeneration");

            if (regen_aura == null)
            {
                regen_aura = FindAura(c, "Regen");
            }

            if (regen_aura != null)
            {
                Regeneration regen = ConvertAura(regen_aura.Details);
                if (regen != null)
                {
                    c.Regeneration = regen;
                    c.Auras.Remove(regen_aura);
                }
            }
        }
Ejemplo n.º 14
0
 private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
 {
     if (e.Url.Scheme == "build")
     {
         if (e.Url.LocalPath == "profile")
         {
             e.Cancel = true;
             CreatureTemplateProfileForm creatureTemplateProfileForm = new CreatureTemplateProfileForm(this.fTemplate);
             if (creatureTemplateProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Name   = creatureTemplateProfileForm.Template.Name;
                 this.fTemplate.Type   = creatureTemplateProfileForm.Template.Type;
                 this.fTemplate.Role   = creatureTemplateProfileForm.Template.Role;
                 this.fTemplate.Leader = creatureTemplateProfileForm.Template.Leader;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "combat")
         {
             e.Cancel = true;
             CreatureTemplateStatsForm creatureTemplateStatsForm = new CreatureTemplateStatsForm(this.fTemplate);
             if (creatureTemplateStatsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.HP         = creatureTemplateStatsForm.Template.HP;
                 this.fTemplate.Initiative = creatureTemplateStatsForm.Template.Initiative;
                 this.fTemplate.AC         = creatureTemplateStatsForm.Template.AC;
                 this.fTemplate.Fortitude  = creatureTemplateStatsForm.Template.Fortitude;
                 this.fTemplate.Reflex     = creatureTemplateStatsForm.Template.Reflex;
                 this.fTemplate.Will       = creatureTemplateStatsForm.Template.Will;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "damage")
         {
             e.Cancel = true;
             if ((new DamageModListForm(this.fTemplate)).ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "senses")
         {
             e.Cancel = true;
             DetailsForm detailsForm = new DetailsForm(this.fTemplate.Senses, "Senses", "");
             if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Senses = detailsForm.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "movement")
         {
             e.Cancel = true;
             DetailsForm detailsForm1 = new DetailsForm(this.fTemplate.Movement, "Movement", "");
             if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Movement = detailsForm1.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "tactics")
         {
             e.Cancel = true;
             DetailsForm detailsForm2 = new DetailsForm(this.fTemplate.Tactics, "Tactics", "");
             if (detailsForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Tactics = detailsForm2.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "power")
     {
         if (e.Url.LocalPath == "addpower")
         {
             e.Cancel = true;
             CreaturePower creaturePower = new CreaturePower()
             {
                 Name   = "New Power",
                 Action = new PowerAction()
             };
             bool             type             = this.fTemplate.Type == CreatureTemplateType.Functional;
             PowerBuilderForm powerBuilderForm = new PowerBuilderForm(creaturePower, null, type);
             if (powerBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.CreaturePowers.Add(powerBuilderForm.Power);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "addtrait")
         {
             e.Cancel = true;
             CreaturePower creaturePower1 = new CreaturePower()
             {
                 Name   = "New Trait",
                 Action = null
             };
             bool             flag = this.fTemplate.Type == CreatureTemplateType.Functional;
             PowerBuilderForm powerBuilderForm1 = new PowerBuilderForm(creaturePower1, null, flag);
             if (powerBuilderForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.CreaturePowers.Add(powerBuilderForm1.Power);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "addaura")
         {
             e.Cancel = true;
             Aura aura = new Aura()
             {
                 Name    = "New Aura",
                 Details = "1"
             };
             AuraForm auraForm = new AuraForm(aura);
             if (auraForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Auras.Add(auraForm.Aura);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "regenedit")
         {
             e.Cancel = true;
             Regeneration     regeneration     = this.fTemplate.Regeneration ?? new Regeneration(5, "");
             RegenerationForm regenerationForm = new RegenerationForm(regeneration);
             if (regenerationForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Regeneration = regenerationForm.Regeneration;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "regenremove")
         {
             e.Cancel = true;
             this.fTemplate.Regeneration = null;
             this.update_statblock();
         }
     }
     if (e.Url.Scheme == "poweredit")
     {
         CreaturePower creaturePower2 = this.find_power(new Guid(e.Url.LocalPath));
         if (creaturePower2 != null)
         {
             e.Cancel = true;
             int              power             = this.fTemplate.CreaturePowers.IndexOf(creaturePower2);
             bool             type1             = this.fTemplate.Type == CreatureTemplateType.Functional;
             PowerBuilderForm powerBuilderForm2 = new PowerBuilderForm(creaturePower2, null, type1);
             if (powerBuilderForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.CreaturePowers[power] = powerBuilderForm2.Power;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "powerremove")
     {
         CreaturePower creaturePower3 = this.find_power(new Guid(e.Url.LocalPath));
         if (creaturePower3 != null)
         {
             e.Cancel = true;
             this.fTemplate.CreaturePowers.Remove(creaturePower3);
             this.update_statblock();
         }
     }
     if (e.Url.Scheme == "auraedit")
     {
         Aura aura1 = this.find_aura(new Guid(e.Url.LocalPath));
         if (aura1 != null)
         {
             e.Cancel = true;
             int      num       = this.fTemplate.Auras.IndexOf(aura1);
             AuraForm auraForm1 = new AuraForm(aura1);
             if (auraForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Auras[num] = auraForm1.Aura;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "auraremove")
     {
         Aura aura2 = this.find_aura(new Guid(e.Url.LocalPath));
         if (aura2 != null)
         {
             e.Cancel = true;
             this.fTemplate.Auras.Remove(aura2);
             this.update_statblock();
         }
     }
 }
Ejemplo n.º 15
0
        private static Effect GetEffect(EffectType prim)
        {
            Effect eff = null;

            switch (prim)
            {
            case EffectType.Speed:
                eff = new Speed();
                break;

            case EffectType.Slowness:
                eff = new Slowness();
                break;

            case EffectType.Haste:
                eff = new Haste();
                break;

            case EffectType.MiningFatigue:
                eff = new MiningFatigue();
                break;

            case EffectType.Strength:
                eff = new Strength();
                break;

            case EffectType.InstantHealth:
                eff = new InstantHealth();
                break;

            case EffectType.InstantDamage:
                eff = new InstantDamage();
                break;

            case EffectType.JumpBoost:
                eff = new JumpBoost();
                break;

            case EffectType.Nausea:
                eff = new Nausea();
                break;

            case EffectType.Regeneration:
                eff = new Regeneration();
                break;

            case EffectType.Resistance:
                eff = new Resistance();
                break;

            case EffectType.FireResistance:
                eff = new FireResistance();
                break;

            case EffectType.WaterBreathing:
                eff = new WaterBreathing();
                break;

            case EffectType.Invisibility:
                eff = new Invisibility();
                break;

            case EffectType.Blindness:
                eff = new Blindness();
                break;

            case EffectType.NightVision:
                eff = new NightVision();
                break;

            case EffectType.Hunger:
                eff = new Hunger();
                break;

            case EffectType.Weakness:
                eff = new Weakness();
                break;

            case EffectType.Poison:
                eff = new Poison();
                break;

            case EffectType.Wither:
                eff = new Wither();
                break;

            case EffectType.HealthBoost:
                eff = new HealthBoost();
                break;

            case EffectType.Absorption:
                eff = new Absorption();
                break;

            case EffectType.Saturation:
                eff = new Saturation();
                break;
            }
            return(eff);
        }
Ejemplo n.º 16
0
        public virtual void Consume(Player player)
        {
            Effect e = null;

            switch (Metadata)
            {
            case 5:
                e = new NightVision
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 6:
                e = new NightVision
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 7:
                e = new Invisibility
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 8:
                e = new Invisibility
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 9:
                e = new JumpBoost
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 10:
                e = new JumpBoost
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 11:
                e = new JumpBoost
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 12:
                e = new FireResistance
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 13:
                e = new FireResistance
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 14:
                e = new Speed
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 15:
                e = new Speed
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 16:
                e = new Speed
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 17:
                e = new Slowness
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 18:
                e = new Slowness
                {
                    Duration = 4800,
                    Level    = 0
                };
                break;

            case 19:
                e = new WaterBreathing
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 20:
                e = new WaterBreathing
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 21:
                e = new InstantHealth
                {
                    Duration = 0,
                    Level    = 0
                };
                break;

            case 22:
                e = new InstantHealth
                {
                    Duration = 0,
                    Level    = 1
                };
                break;

            case 23:
                e = new InstantDamage
                {
                    Duration = 0,
                    Level    = 0
                };
                break;

            case 24:
                e = new InstantDamage
                {
                    Duration = 0,
                    Level    = 1
                };
                break;

            case 25:
                e = new Poison
                {
                    Duration = 900,
                    Level    = 0
                };
                break;

            case 26:
                e = new Poison
                {
                    Duration = 2400,
                    Level    = 0
                };
                break;

            case 27:
                e = new Poison
                {
                    Duration = 440,
                    Level    = 1
                };
                break;

            case 28:
                e = new Regeneration
                {
                    Duration = 900,
                    Level    = 0
                };
                break;

            case 29:
                e = new Regeneration
                {
                    Duration = 2400,
                    Level    = 0
                };
                break;

            case 30:
                e = new Regeneration
                {
                    Duration = 440,
                    Level    = 1
                };
                break;

            case 31:
                e = new Strength
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 32:
                e = new Strength
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 33:
                e = new Strength
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 34:
                e = new Weakness
                {
                    Duration = 1800,
                    Level    = 0
                };
                break;

            case 35:
                e = new Weakness
                {
                    Duration = 4800,
                    Level    = 0
                };
                break;
            }

            if (e != null)
            {
                player.SetEffect(e);
            }
        }
Ejemplo n.º 17
0
        public void Effect(Player player, string effect, int level, int duration)
        {
            if ("clear".Equals(effect, StringComparison.InvariantCultureIgnoreCase))
            {
                player.Level.BroadcastMessage($"Removed all effects for {player.Username}.", MessageType.Raw);
                player.RemoveAllEffects();
                return;
            }

            EffectType effectType;

            if (Enum.TryParse(effect, true, out effectType))
            {
                Effect eff = null;
                switch (effectType)
                {
                case EffectType.Speed:
                    eff = new Speed();
                    break;

                case EffectType.Slowness:
                    eff = new Slowness();
                    break;

                case EffectType.Haste:
                    eff = new Haste();
                    break;

                case EffectType.MiningFatigue:
                    eff = new MiningFatigue();
                    break;

                case EffectType.Strength:
                    eff = new Strength();
                    break;

                case EffectType.InstantHealth:
                    eff = new InstantHealth();
                    break;

                case EffectType.InstantDamage:
                    eff = new InstantDamage();
                    break;

                case EffectType.JumpBoost:
                    eff = new JumpBoost();
                    break;

                case EffectType.Nausea:
                    eff = new Nausea();
                    break;

                case EffectType.Regeneration:
                    eff = new Regeneration();
                    break;

                case EffectType.Resistance:
                    eff = new Resistance();
                    break;

                case EffectType.FireResistance:
                    eff = new FireResistance();
                    break;

                case EffectType.WaterBreathing:
                    eff = new WaterBreathing();
                    break;

                case EffectType.Invisibility:
                    eff = new Invisibility();
                    break;

                case EffectType.Blindness:
                    eff = new Blindness();
                    break;

                case EffectType.NightVision:
                    eff = new NightVision();
                    break;

                case EffectType.Hunger:
                    eff = new Hunger();
                    break;

                case EffectType.Weakness:
                    eff = new Weakness();
                    break;

                case EffectType.Poison:
                    eff = new Poison();
                    break;

                case EffectType.Wither:
                    eff = new Wither();
                    break;

                case EffectType.HealthBoost:
                    eff = new HealthBoost();
                    break;

                case EffectType.Absorption:
                    eff = new Absorption();
                    break;

                case EffectType.Saturation:
                    eff = new Saturation();
                    break;
                }

                if (eff != null)
                {
                    eff.Level     = level;
                    eff.Duration  = duration;
                    eff.Particles = false;

                    player.SetEffect(eff);
                    player.Level.BroadcastMessage($"{player.Username} added effect {effectType} with strenght {level}", MessageType.Raw);
                }
            }
        }
Ejemplo n.º 18
0
        public void Effect(Player player, string effect, int level = 1, int duration = 20)
        {
            EffectType effectType;

            if (Enum.TryParse(effect, true, out effectType))
            {
                Effect eff = null;
                switch (effectType)
                {
                case EffectType.Speed:
                    eff = new Speed();
                    break;

                case EffectType.Slowness:
                    eff = new Slowness();
                    break;

                case EffectType.Haste:
                    eff = new Haste();
                    break;

                case EffectType.MiningFatigue:
                    eff = new MiningFatigue();
                    break;

                case EffectType.Strenght:
                    eff = new Strength();
                    break;

                case EffectType.InstandHealth:
                    eff = new InstandHealth();
                    break;

                case EffectType.InstantDamage:
                    eff = new InstantDamage();
                    break;

                case EffectType.JumpBoost:
                    eff = new JumpBoost();
                    break;

                case EffectType.Nausea:
                    eff = new Nausea();
                    break;

                case EffectType.Regeneration:
                    eff = new Regeneration();
                    break;

                case EffectType.Resistance:
                    eff = new Resistance();
                    break;

                case EffectType.FireResistance:
                    eff = new FireResistance();
                    break;

                case EffectType.WaterBreathing:
                    eff = new WaterBreathing();
                    break;

                case EffectType.Invisibility:
                    eff = new Invisibility();
                    break;

                case EffectType.Blindness:
                    eff = new Blindness();
                    break;

                case EffectType.NightVision:
                    eff = new NightVision();
                    break;

                case EffectType.Hunger:
                    eff = new Hunger();
                    break;

                case EffectType.Weakness:
                    eff = new Weakness();
                    break;

                case EffectType.Poison:
                    eff = new Poison();
                    break;

                case EffectType.Wither:
                    eff = new Wither();
                    break;

                case EffectType.HealthBoost:
                    eff = new HealthBoost();
                    break;

                case EffectType.Absorption:
                    eff = new Absorption();
                    break;

                case EffectType.Saturation:
                    eff = new Saturation();
                    break;

                case EffectType.Glowing:
                    eff = new Glowing();
                    break;

                case EffectType.Levitation:
                    eff = new Levitation();
                    break;
                }

                if (eff != null)
                {
                    eff.Level     = level;
                    eff.Duration  = duration;
                    eff.Particles = false;

                    player.SetEffect(eff);
                    player.Level.BroadcastMessage(string.Format("{0} added effect {1} with strenght {2}", player.Username, effectType, level), MessageType.Raw);
                }
            }
        }
Ejemplo n.º 19
0
    // Public
    static public Regeneration Default()
    {
        Regeneration regeneration = new Regeneration();

        return(regeneration);
    }
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "build")
            {
                if (e.Url.LocalPath == "profile")
                {
                    e.Cancel = true;

                    CreatureTemplateProfileForm dlg = new CreatureTemplateProfileForm(fTemplate);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Name   = dlg.Template.Name;
                        fTemplate.Type   = dlg.Template.Type;
                        fTemplate.Role   = dlg.Template.Role;
                        fTemplate.Leader = dlg.Template.Leader;

                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "combat")
                {
                    e.Cancel = true;

                    CreatureTemplateStatsForm dlg = new CreatureTemplateStatsForm(fTemplate);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.HP         = dlg.Template.HP;
                        fTemplate.Initiative = dlg.Template.Initiative;
                        fTemplate.AC         = dlg.Template.AC;
                        fTemplate.Fortitude  = dlg.Template.Fortitude;
                        fTemplate.Reflex     = dlg.Template.Reflex;
                        fTemplate.Will       = dlg.Template.Will;

                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "damage")
                {
                    e.Cancel = true;

                    DamageModListForm dlg = new DamageModListForm(fTemplate);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "senses")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fTemplate.Senses, "Senses", "");
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Senses = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "movement")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fTemplate.Movement, "Movement", "");
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Movement = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "tactics")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fTemplate.Tactics, "Tactics", "");
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Tactics = dlg.Details;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "power")
            {
                if (e.Url.LocalPath == "addpower")
                {
                    e.Cancel = true;

                    CreaturePower pwr = new CreaturePower();
                    pwr.Name   = "New Power";
                    pwr.Action = new PowerAction();

                    bool             functional = fTemplate.Type == CreatureTemplateType.Functional;
                    PowerBuilderForm dlg        = new PowerBuilderForm(pwr, null, functional);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.CreaturePowers.Add(dlg.Power);
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "addtrait")
                {
                    e.Cancel = true;

                    CreaturePower pwr = new CreaturePower();
                    pwr.Name   = "New Trait";
                    pwr.Action = null;

                    bool             functional = fTemplate.Type == CreatureTemplateType.Functional;
                    PowerBuilderForm dlg        = new PowerBuilderForm(pwr, null, functional);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.CreaturePowers.Add(dlg.Power);
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "addaura")
                {
                    e.Cancel = true;

                    Aura aura = new Aura();
                    aura.Name    = "New Aura";
                    aura.Details = "1";

                    AuraForm dlg = new AuraForm(aura);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Auras.Add(dlg.Aura);
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "regenedit")
                {
                    e.Cancel = true;

                    Regeneration regen = fTemplate.Regeneration;
                    if (regen == null)
                    {
                        regen = new Regeneration(5, "");
                    }

                    RegenerationForm dlg = new RegenerationForm(regen);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Regeneration = dlg.Regeneration;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "regenremove")
                {
                    e.Cancel = true;

                    fTemplate.Regeneration = null;
                    update_statblock();
                }
            }

            if (e.Url.Scheme == "powerup")
            {
            }

            if (e.Url.Scheme == "powerdown")
            {
            }

            if (e.Url.Scheme == "poweredit")
            {
                CreaturePower pwr = find_power(new Guid(e.Url.LocalPath));
                if (pwr != null)
                {
                    e.Cancel = true;
                    int index = fTemplate.CreaturePowers.IndexOf(pwr);

                    bool             functional = fTemplate.Type == CreatureTemplateType.Functional;
                    PowerBuilderForm dlg        = new PowerBuilderForm(pwr, null, functional);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.CreaturePowers[index] = dlg.Power;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "powerremove")
            {
                CreaturePower pwr = find_power(new Guid(e.Url.LocalPath));
                if (pwr != null)
                {
                    e.Cancel = true;

                    fTemplate.CreaturePowers.Remove(pwr);
                    update_statblock();
                }
            }

            if (e.Url.Scheme == "auraedit")
            {
                Aura aura = find_aura(new Guid(e.Url.LocalPath));
                if (aura != null)
                {
                    e.Cancel = true;
                    int index = fTemplate.Auras.IndexOf(aura);

                    AuraForm dlg = new AuraForm(aura);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Auras[index] = dlg.Aura;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "auraremove")
            {
                Aura aura = find_aura(new Guid(e.Url.LocalPath));
                if (aura != null)
                {
                    e.Cancel = true;

                    fTemplate.Auras.Remove(aura);
                    update_statblock();
                }
            }
        }
Ejemplo n.º 21
0
    /*
     * Updates the counters for the effects currently on the player.
     * Called in Character.cs's NewEffect(), an override of a method in Unit.cs.
     */
    public void updateEffectTimers(Effect effect)
    {
        Debug.Log("Called updateEffectTimers. effect name is " + effect.effectName);
        switch (effect.effectName)
        {
        case "Empowered":
        {
            if (effect.isLongest)
            {
                longestEmp = (Empowered)effect;
            }
            Debug.Log("Setting longestEmp.");
            break;
        }

        case "Regeneration":
        {
            if (effect.isLongest)
            {
                longestReg = (Regeneration)effect;
            }
            Debug.Log("Setting longestReg.");
            break;
        }

        case "Degeneration":
        {
            if (effect.isLongest)
            {
                longestDegen = (Degeneration)effect;
            }
            Debug.Log("Setting longestDegen.");
            break;
        }

        case "Burning":
        {
            if (effect.isLongest)
            {
                longestBurn = (Burning)effect;
            }
            Debug.Log("Setting longestBurn.");
            break;
        }

        case "Armored":
        {
            if (effect.isLongest)
            {
                longestArmor = (Armored)effect;
            }
            Debug.Log("Setting longestArmor.");
            break;
        }

        case "Focused":
        {
            if (effect.isLongest)
            {
                longestFocus = (Focused)effect;
            }
            Debug.Log("Setting longestFocus.");
            break;
        }

        case "Hasted":
        {
            if (effect.isLongest)
            {
                longestHaste = (Hasted)effect;
            }
            Debug.Log("Setting longestHaste.");
            break;
        }

        case "Swiftness":
        {
            if (effect.isLongest)
            {
                longestSwift = (Swiftness)effect;
            }
            Debug.Log("Setting longestSwift.");
            break;
        }

        case "Crippled":
        {
            if (effect.isLongest)
            {
                longestCrip = (Crippled)effect;
            }
            Debug.Log("Setting longestCrip.");
            break;
        }

        default:
        {
            Debug.Log("Invalid effect.");
            break;
        }
        }
    }
Ejemplo n.º 22
0
        public static void ResetRegeneration()
        {
            WriteDebug($"[{ FightClassSettings.Name }] resetting resting");

            Regeneration.LoadUserDeclaredValues();
        }
Ejemplo n.º 23
0
        public static void ForceRegeneration()
        {
            WriteDebug($"[{ FightClassSettings.Name }] forcing resting");

            Regeneration.NewFoodValues(90, 95);
        }