예제 #1
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);
                }
            }
        }
예제 #2
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);
                }
            }
        }
예제 #3
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);
            }
        }