Exemple #1
0
        public void Update()
        {
            this.mouse    = Mouse.GetState();
            this.keyboard = Keyboard.GetState();

            this.UpdateCursor();

            if (this.keyboard.IsKeyDown(Keys.Enter) && this.previousKeyboard.IsKeyUp(Keys.Enter) &&
                this.controlScreenItems.Count != 0)
            {
                if (this.controlScreenItems[this.selectedEntry].ItemText == "Back")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.MainMenu);
                }
            }

            if (this.mouse.LeftButton == ButtonState.Pressed)
            {
                foreach (var item in this.controlScreenItems)
                {
                    if (this.mouse.X > item.ItemPosition.X && this.mouse.X < item.ItemPosition.X + item.ItemTexture.Bounds.Width &&
                        this.mouse.Y > item.ItemPosition.Y && this.mouse.Y < item.ItemPosition.Y + item.ItemTexture.Bounds.Height)
                    {
                        if (item.ItemText == "Back")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.MainMenu);
                            break;
                        }
                    }
                }
            }

            this.previousKeyboard = this.keyboard;
        }
Exemple #2
0
        public async Task AddXpAsync(int amount, DSharpPlus.CommandsNext.CommandContext c = null)
        {
            bool hasLeveled = false;

            XpCurrent += amount;

            if (XpCurrent >= XpNext)
            {
                hasLeveled = true;

                while (XpCurrent >= XpNext)
                {
                    XpCurrent = XpCurrent - XpNext;
                    Level++;
                    XpNext = Rpg.GetNextXp(Level);

                    SkillPoints     += Realm.GetSetting <int>("skill_points_per_levelup");
                    AttributePoints += Realm.GetSetting <int>("attribute_points_per_levelup");
                }
            }

            if (hasLeveled == false || c == null)
            {
                return;
            }

            HpMax     = Rpg.GetBaseHpForLevel(Level);
            HpCurrent = HpMax;

            var g = await Bot.RpgBot.Client.GetGuildAsync(GuildId);

            var m = await g.GetMemberAsync(ulong.Parse(Id));

            await c.Channel.SendMessageAsync($"{m.Mention} is now level {Level}!");
        }
        public override global::System.Data.DataSet Clone()
        {
            Rpg cln = ((Rpg)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Exemple #4
0
        public void Update()
        {
            this.mouse    = Mouse.GetState();
            this.keyboard = Keyboard.GetState();

            this.UpdateCursor();

            if (this.keyboard.IsKeyDown(Keys.Right) && this.previousKeyboard.IsKeyUp(Keys.Right))
            {
                this.chooseHeroList[this.selectedEntry].Selected = false;
                if (this.selectedEntry < this.chooseHeroList.Count - 1)
                {
                    this.selectedEntry++;
                }

                this.chooseHeroList[this.selectedEntry].Selected = true;
            }

            if (this.keyboard.IsKeyDown(Keys.Left) && this.previousKeyboard.IsKeyUp(Keys.Left))
            {
                this.chooseHeroList[this.selectedEntry].Selected = false;
                if (this.selectedEntry > 0)
                {
                    this.selectedEntry--;
                }

                this.chooseHeroList[this.selectedEntry].Selected = true;
            }

            if (this.keyboard.IsKeyDown(Keys.Enter) && this.previousKeyboard.IsKeyUp(Keys.Enter))
            {
                if (this.inMenu)
                {
                    HeroName = this.chooseHeroList[this.selectedEntry].ItemText;
                    Rpg.ActiveWindowSet(EnumActiveWindow.GameWindow);
                }
            }

            if (this.previousMouse.LeftButton == ButtonState.Released && this.mouse.LeftButton == ButtonState.Pressed)
            {
                foreach (var item in this.chooseHeroList)
                {
                    if (this.mouse.X > item.ItemPosition.X && this.mouse.X < item.ItemPosition.X + item.ItemTexture.Bounds.Width &&
                        this.mouse.Y > item.ItemPosition.Y && this.mouse.Y < item.ItemPosition.Y + item.ItemTexture.Bounds.Height)
                    {
                        HeroName = item.ItemText;
                        Rpg.ActiveWindowSet(EnumActiveWindow.GameWindow);
                    }
                }
            }

            this.previousMouse    = this.mouse;
            this.previousKeyboard = this.keyboard;
            this.inMenu           = true;
        }
Exemple #5
0
 void SetComponents()
 {
     gunFireAudioSource = GetComponent <AudioSource>();
     spriteRenderer     = GetComponent <SpriteRenderer>();
     gameObject.AddComponent <PlayerController>();
     gun     = GetComponent <Gun>();
     shotgun = GetComponent <Shotgun>();
     rifle   = GetComponent <Rifle>();
     rpg     = GetComponent <Rpg>();
     sniper  = GetComponent <Sniper>();
 }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            Rpg ds = new Rpg();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Exemple #7
0
        public Enemy(EncounterTemplate tmp, int playerLevel)
        {
            Name = tmp.TemplateName;

            if (tmp.AdjustToPlayerLevel)
            {
                Level = Rng.Instance.Next(0, 100) > 50
                                        ? playerLevel + Rng.Instance.Next(tmp.LevelRangeMin, tmp.LevelRangeMax)
                                        : playerLevel - Rng.Instance.Next(tmp.LevelRangeMin, tmp.LevelRangeMax);
            }
            else
            {
                Level = Rng.Instance.Next(tmp.LevelRangeMin, tmp.LevelRangeMax);
            }

            if (Level < 1)
            {
                Level = 1;
            }

            if (tmp.AutoHp)
            {
                HpMax = Rng.Instance.Next(0, 100) > 50
                                        ? Rpg.GetBaseHpForLevel(Level) + Rng.Instance.Next(0, tmp.HpVariance)
                                        : Rpg.GetBaseHpForLevel(Level) - Rng.Instance.Next(0, tmp.HpVariance);
            }
            else
            {
                HpMax = Rng.Instance.Next(0, 100) > 50
                                        ? tmp.BaseHp + Rng.Instance.Next(0, tmp.HpVariance)
                                        : tmp.BaseHp - Rng.Instance.Next(0, tmp.HpVariance);
            }

            Attributes = tmp.Attributes ?? new AttributeBlock(1);
            Equipment  = tmp.Equipment ?? new EquipSet();

            HpCurrent = HpMax;

            TemplateId = tmp.Id;
        }
 static void Main()
 {
     Rpg game = new Rpg();
     game.Run();
 }
Exemple #9
0
 public int GetActualXpReward(int playerLevel, int enemyLevel)
 {
     return((int)System.Math.Round(XpReward * Rpg.GetGainedXpModifier(playerLevel, enemyLevel)));
 }
        static void Main()
        {
            Rpg game = new Rpg();

            game.Run();
        }
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                Rpg ds = new Rpg();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "ElementDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Exemple #12
0
 public override void CreateBullet(Weapon weapon, Vector2 range, bool random)
 {
     rpg = weapon.gameObject.GetComponent <Rpg>();
     CreateBulletTypeInfo(weapon, demage, speed, range, random, 1);
 }
Exemple #13
0
        public void Update()
        {
            this.mouse    = Mouse.GetState();
            this.keyboard = Keyboard.GetState();

            this.UpdateCursor();

            if (this.keyboard.IsKeyDown(Keys.Down) && this.previousKeyboard.IsKeyUp(Keys.Down))
            {
                PMainMenuItems[this.selectedEntry].Selected = false;
                if (this.selectedEntry < PMainMenuItems.Count - 1)
                {
                    this.selectedEntry++;
                }

                PMainMenuItems[this.selectedEntry].Selected = true;
            }

            if (this.keyboard.IsKeyDown(Keys.Up) && this.previousKeyboard.IsKeyUp(Keys.Up))
            {
                PMainMenuItems[this.selectedEntry].Selected = false;
                if (this.selectedEntry > 0)
                {
                    this.selectedEntry--;
                }

                PMainMenuItems[this.selectedEntry].Selected = true;
            }

            if (this.keyboard.IsKeyDown(Keys.Enter) && this.previousKeyboard.IsKeyUp(Keys.Enter))
            {
                if (PMainMenuItems[this.selectedEntry].ItemText == "NEW GAME")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.ChooseHeroWindow);
                }

                if (PMainMenuItems[this.selectedEntry].ItemText == "RESUME GAME")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.GameWindow);
                }

                if (PMainMenuItems[this.selectedEntry].ItemText == "CONTROLS")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.ControlWindow);
                }

                if (PMainMenuItems[this.selectedEntry].ItemText == "ABOUT")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.AboutWindow);
                }

                if (PMainMenuItems[this.selectedEntry].ItemText == "EXIT GAME")
                {
                    Environment.Exit(1);
                }
            }

            if (this.previousMouse.LeftButton == ButtonState.Released && this.mouse.LeftButton == ButtonState.Pressed)
            {
                foreach (var item in PMainMenuItems)
                {
                    if (this.mouse.X > item.ItemPosition.X && this.mouse.X < item.ItemPosition.X + item.ItemTexture.Bounds.Width &&
                        this.mouse.Y > item.ItemPosition.Y && this.mouse.Y < item.ItemPosition.Y + item.ItemTexture.Bounds.Height)
                    {
                        if (item.ItemText == "NEW GAME")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.ChooseHeroWindow);
                            break;
                        }

                        if (item.ItemText == "RESUME GAME")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.GameWindow);
                            break;
                        }

                        if (item.ItemText == "CONTROLS")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.ControlWindow);
                            break;
                        }

                        if (item.ItemText == "ABOUT")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.AboutWindow);
                            break;
                        }

                        if (item.ItemText == "EXIT GAME")
                        {
                            Environment.Exit(1);
                        }
                    }
                }
            }

            this.previousKeyboard = this.keyboard;
            this.previousMouse    = this.mouse;
        }