Пример #1
0
 public void ReadRunes(RuneCollection runes)
 {
     foreach (var r in runes)
     {
         this.runeClues.Add(r.Text);
     }
 }
Пример #2
0
        public void InitEnemies(RuneCollection runes)
        {
            // Add Orcs to the maze
            var orc1 = new Orc(this.consoleOut, this.soundPlayer, "Grundle", "A nasty little orc");

            orc1.AddToInventory(new BattleAxe(this.consoleOut, this.soundPlayer));
            if (runes.Count > 0)
            {
                orc1.AddToInventory(runes.UseNext());
            }
            this.Enemies.Add(orc1);
            var curRoom = this.PickRandomRoom();

            curRoom.Characters.Add(orc1);

            var orc2 = new Orc(this.consoleOut, this.soundPlayer, "Brundle", "A nasty little orc");

            if (runes.Count > 0)
            {
                orc2.AddToInventory(runes.UseNext());
            }
            orc2.AddToInventory(new Dagger(this.consoleOut, this.soundPlayer));
            this.Enemies.Add(orc2);
            curRoom = this.PickRandomRoom();
            curRoom.Characters.Add(orc2);

            // Add Trolls to the maze
            var troll1 = new Troll(this.consoleOut, this.soundPlayer, "Slackfart", "An ugly, stupid troll");

            troll1.AddToInventory(runes.UseNext());
            if (runes.Count > 0)
            {
                troll1.AddToInventory(runes.UseNext());
            }
            this.Enemies.Add(troll1);
            curRoom = this.PickRandomRoom();
            curRoom.Characters.Add(troll1);

            var troll2 = new Troll(this.consoleOut, this.soundPlayer, "Slugbutt", "An ugly, stupid troll");

            troll2.AddToInventory(runes.UseNext());
            if (runes.Count > 0)
            {
                troll2.AddToInventory(runes.UseNext());
            }
            this.Enemies.Add(troll2);
            curRoom = this.PickRandomRoom();
            curRoom.Characters.Add(troll2);

            var troll3 = new Troll(this.consoleOut, this.soundPlayer, "Frickbar the very unpleasant", "An ugly, stupid troll");

            if (runes.Count > 0)
            {
                troll3.AddToInventory(runes.UseNext());
            }
            this.Enemies.Add(troll3);
            curRoom = this.PickRandomRoom();
            curRoom.Characters.Add(troll3);
        }
Пример #3
0
        public Champion(string model,
                        uint playerId,
                        uint playerTeamSpecialId,
                        RuneCollection runeList,
                        ClientInfo clientInfo,
                        uint netId = 0)
            : base(model, new Stats(), 30, 0, 0, 1200, netId)
        {
            _playerId            = playerId;
            _playerTeamSpecialId = playerTeamSpecialId;
            RuneList             = runeList;

            Inventory = InventoryManager.CreateInventory(this);
            Shop      = Shop.CreateShop(this);

            Stats.Gold = 475.0f;
            Stats.GoldPerSecond.BaseValue = _game.Map.MapGameScript.GoldPerSecond;
            Stats.SetGeneratingGold(false);

            //TODO: automaticaly rise spell levels with CharData.SpellLevelsUp
            for (short i = 0; i < CharData.SpellNames.Length; i++)
            {
                if (CharData.SpellNames[i] != "")
                {
                    Spells[i] = new Spell(this, CharData.SpellNames[i], (byte)(i));
                }
            }
            Spells[4] = new Spell(this, clientInfo.SummonerSkills[0], 4);
            Spells[5] = new Spell(this, clientInfo.SummonerSkills[1], 5);

            for (short i = 0; i < 6; i++)
            {
                Spells[(byte)(i + 6)] = new Spell(this, "BaseSpell", (byte)(i + 6));
            }

            Spells[13] = new Spell(this, "Recall", 13);

            for (short i = 0; i < CharData.Passives.Length; i++)
            {
                if (CharData.Passives[i].PassiveLuaName != "")
                {
                    Spells[(byte)(i + 14)] = new Spell(this, CharData.Passives[i].PassiveLuaName, (byte)(i + 14));
                }
            }

            for (short i = 0; i < CharData.ExtraSpells.Length; i++)
            {
                if (CharData.ExtraSpells[i] != "")
                {
                    var spell = new Spell(this, CharData.ExtraSpells[i], (byte)(i + 45));
                    Spells[(byte)(i + 45)] = spell;
                    spell.levelUp();
                }
            }
            Spells[4].levelUp();
            Spells[5].levelUp();
        }
Пример #4
0
        public void InitNeutralCharacters(RuneCollection runes)
        {
            var wizard1 = new Wizard(this.consoleOut, this.soundPlayer, "Merlin", "A powerful and all knowing wizard");

            wizard1.ReadRunes(runes);
            this.NeutralCharacters.Add(wizard1);
            var curRoom = this.PickRandomRoom();

            curRoom.Characters.Add(wizard1);
        }
Пример #5
0
        public override void Initialize()
        {
            base.Initialize();

            // Initialize the entire map with walls first
            for (int i = 0; i < NumRows; i++)
            {
                for (int j = 0; j < NumColumns; j++)
                {
                    this.Tiles[i, j] = new Wall(this.consoleOut);
                }
            }

            bool isMazeGenerated = false;

            if (!string.IsNullOrEmpty(mapName))
            {
                if (mapName.ToLower().CompareTo("singlecorridor") == 0)
                {
                    this.InitMazeSingleCorridor();
                    isMazeGenerated = true;
                }
                else if (mapName.ToLower().CompareTo("crosspattern") == 0)
                {
                    this.InitMazeCrossPattern();
                    isMazeGenerated = true;
                }
                else if (mapName.ToLower().CompareTo("crosswithsquare") == 0)
                {
                    this.InitMazeCrossWithSquare();
                    isMazeGenerated = true;
                }
            }

            if (!isMazeGenerated)
            {
                this.InitMazeRandomCorridors();
            }

            var runes = new RuneCollection();

            this.InitStartRoom(this.rooms.First());
            this.InitRoomFeatures(runes);
            this.InitWeapons();
            this.InitNeutralCharacters(runes);
            this.InitFriends(runes);
            this.InitEnemies(runes);
            this.InitPowerups();
        }
Пример #6
0
        public PlayerConfig(JToken playerData)
        {
            _playerData = playerData;
            try
            {
                var runes = _playerData.SelectToken("runes");
                _runeList = new RuneCollection();

                foreach (JProperty runeCategory in runes)
                {
                    _runeList.Add(Convert.ToInt32(runeCategory.Name), Convert.ToInt32(runeCategory.Value));
                }
            }
            catch (Exception)
            {
                // no runes set in config
            }
        }
Пример #7
0
        public void InitFriends(RuneCollection runes)
        {
            // Add Ginger to the maze
            var ginger = new Dog(this.consoleOut, this.soundPlayer, "Ginger", "A cute but somewhat dim puppy dog");

            this.Friends.Add(ginger);
            Room curRoom = this.PickRandomRoom();

            curRoom.Characters.Add(ginger);

            // Add Bombur to the maze
            var dwarf1 = new Dwarf(this.consoleOut, this.soundPlayer, "Bombur", "Bombur son of Dwalin");

            dwarf1.AddToInventory(new Staff(this.consoleOut, this.soundPlayer));
            dwarf1.UseItem <Staff>();
            if (runes.Count > 0)
            {
                dwarf1.AddToInventory(runes.UseNext());
            }
            this.Friends.Add(dwarf1);
            curRoom = this.PickRandomRoom();
            curRoom.Characters.Add(dwarf1);

            // Add Gimli to the maze
            var dwarf2 = new Dwarf(this.consoleOut, this.soundPlayer, "Gimli", "Gimli son of Gloin");

            dwarf2.AddToInventory(new BattleAxe(this.consoleOut, this.soundPlayer));
            dwarf2.UseItem <BattleAxe>();
            if (runes.Count > 0)
            {
                dwarf2.AddToInventory(runes.UseNext());
            }
            this.Friends.Add(dwarf2);
            curRoom = this.PickRandomRoom();
            curRoom.Characters.Add(dwarf2);
        }
Пример #8
0
        public Champion(string model, uint playerId, RuneCollection runeList, uint netId = 0)
            : base(model, new Stats(), 30, 0, 0, 1200, netId)
        {
            this._playerId = playerId;
            this.RuneList  = runeList;

            Inventory = InventoryManager.CreateInventory(this);
            Shop      = Shop.CreateShop(this);

            stats.Gold = 475.0f;
            stats.GoldPerSecond.BaseValue = _game.Map.GetGoldPerSecond();
            stats.SetGeneratingGold(false);

            Inibin inibin;

            if (!_rafManager.readInibin("DATA/Characters/" + Model + "/" + Model + ".inibin", out inibin))
            {
                _logger.LogCoreError("couldn't find champion stats for " + Model);
                return;
            }

            stats.HealthPoints.BaseValue          = inibin.getFloatValue("Data", "BaseHP");
            stats.CurrentHealth                   = stats.HealthPoints.Total;
            stats.ManaPoints.BaseValue            = inibin.getFloatValue("Data", "BaseMP");
            stats.CurrentMana                     = stats.ManaPoints.Total;
            stats.AttackDamage.BaseValue          = inibin.getFloatValue("DATA", "BaseDamage");
            stats.Range.BaseValue                 = inibin.getFloatValue("DATA", "AttackRange");
            stats.MoveSpeed.BaseValue             = inibin.getFloatValue("DATA", "MoveSpeed");
            stats.Armor.BaseValue                 = inibin.getFloatValue("DATA", "Armor");
            stats.MagicResist.BaseValue           = inibin.getFloatValue("DATA", "SpellBlock");
            stats.HealthRegeneration.BaseValue    = inibin.getFloatValue("DATA", "BaseStaticHPRegen");
            stats.ManaRegeneration.BaseValue      = inibin.getFloatValue("DATA", "BaseStaticMPRegen");
            stats.AttackSpeedFlat                 = 0.625f / (1 + inibin.getFloatValue("DATA", "AttackDelayOffsetPercent"));
            stats.AttackSpeedMultiplier.BaseValue = 1.0f;

            stats.HealthPerLevel             = inibin.getFloatValue("DATA", "HPPerLevel");
            stats.ManaPerLevel               = inibin.getFloatValue("DATA", "MPPerLevel");
            stats.AdPerLevel                 = inibin.getFloatValue("DATA", "DamagePerLevel");
            stats.ArmorPerLevel              = inibin.getFloatValue("DATA", "ArmorPerLevel");
            stats.MagicResistPerLevel        = inibin.getFloatValue("DATA", "SpellBlockPerLevel");
            stats.HealthRegenerationPerLevel = inibin.getFloatValue("DATA", "HPRegenPerLevel");
            stats.ManaRegenerationPerLevel   = inibin.getFloatValue("DATA", "MPRegenPerLevel");
            stats.GrowthAttackSpeed          = inibin.getFloatValue("DATA", "AttackSpeedPerLevel");

            Spells = new List <Spell>();
            Spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell1"), 0));
            Spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell2"), 1));
            Spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell3"), 2));
            Spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell4"), 3));
            Spells.Add(new Spell(this, "SummonerHeal", 4));
            Spells.Add(new Spell(this, "SummonerFlash", 5));
            Spells.Add(new Spell(this, "Recall", 13));

            IsMelee         = inibin.getBoolValue("DATA", "IsMelee");
            CollisionRadius = inibin.getIntValue("DATA", "PathfindingCollisionRadius");

            var autoAttack = _rafManager.GetAutoAttackData(Model);

            if (autoAttack != null)
            {
                AutoAttackDelay           = autoAttack.getFloatValue("SpellData", "castFrame") / 30.0f;
                AutoAttackProjectileSpeed = autoAttack.getFloatValue("SpellData", "MissileSpeed");
            }

            LoadLua();
        }
Пример #9
0
        public Champion(string model, uint playerId, uint playerTeamSpecialId, RuneCollection runeList, uint netId = 0)
            : base(model, new Stats(), 30, 0, 0, 1200, netId)
        {
            _playerId            = playerId;
            _playerTeamSpecialId = playerTeamSpecialId;
            RuneList             = runeList;

            Inventory = InventoryManager.CreateInventory(this);
            Shop      = Shop.CreateShop(this);

            stats.Gold = 475.0f;
            stats.GoldPerSecond.BaseValue = _game.Map.GetGoldPerSecond();
            stats.SetGeneratingGold(false);

            JObject data;

            if (!_rafManager.ReadUnitStats(model, out data))
            {
                _logger.LogCoreError("Couldn't find champion stats for " + Model);
                return;
            }

            stats.HealthPoints.BaseValue          = _rafManager.GetFloatValue(data, "Data", "BaseHP");
            stats.CurrentHealth                   = stats.HealthPoints.Total;
            stats.ManaPoints.BaseValue            = _rafManager.GetFloatValue(data, "Data", "BaseMP");
            stats.CurrentMana                     = stats.ManaPoints.Total;
            stats.AttackDamage.BaseValue          = _rafManager.GetFloatValue(data, "Data", "BaseDamage");
            stats.Range.BaseValue                 = _rafManager.GetFloatValue(data, "Data", "AttackRange");
            stats.MoveSpeed.BaseValue             = _rafManager.GetFloatValue(data, "Data", "MoveSpeed");
            stats.Armor.BaseValue                 = _rafManager.GetFloatValue(data, "Data", "Armor");
            stats.MagicResist.BaseValue           = _rafManager.GetFloatValue(data, "Data", "SpellBlock");
            stats.HealthRegeneration.BaseValue    = _rafManager.GetFloatValue(data, "Data", "BaseStaticHPRegen");
            stats.ManaRegeneration.BaseValue      = _rafManager.GetFloatValue(data, "Data", "BaseStaticMPRegen");
            stats.AttackSpeedFlat                 = 0.625f / (1 + _rafManager.GetFloatValue(data, "Data", "AttackDelayOffsetPercent"));
            stats.AttackSpeedMultiplier.BaseValue = 1.0f;

            stats.HealthPerLevel             = _rafManager.GetFloatValue(data, "Data", "HPPerLevel");
            stats.ManaPerLevel               = _rafManager.GetFloatValue(data, "Data", "MPPerLevel");
            stats.AdPerLevel                 = _rafManager.GetFloatValue(data, "Data", "DamagePerLevel");
            stats.ArmorPerLevel              = _rafManager.GetFloatValue(data, "Data", "ArmorPerLevel");
            stats.MagicResistPerLevel        = _rafManager.GetFloatValue(data, "Data", "SpellBlockPerLevel");
            stats.HealthRegenerationPerLevel = _rafManager.GetFloatValue(data, "Data", "HPRegenPerLevel");
            stats.ManaRegenerationPerLevel   = _rafManager.GetFloatValue(data, "Data", "MPRegenPerLevel");
            stats.GrowthAttackSpeed          = _rafManager.GetFloatValue(data, "Data", "AttackSpeedPerLevel");

            Spells = new Dictionary <short, Spell>
            {
                { 0, new Spell(this, _rafManager.GetStringValue(data, "Data", "Spell1"), 0) },
                { 1, new Spell(this, _rafManager.GetStringValue(data, "Data", "Spell2"), 1) },
                { 2, new Spell(this, _rafManager.GetStringValue(data, "Data", "Spell3"), 2) },
                { 3, new Spell(this, _rafManager.GetStringValue(data, "Data", "Spell4"), 3) },
                { 4, new Spell(this, "SummonerHeal", 4) },
                { 5, new Spell(this, "SummonerFlash", 5) },
                { 13, new Spell(this, "Recall", 13) }
            };

            ExtraSpells = new List <string>();

            for (var i = 1; true; i++)
            {
                if (string.IsNullOrEmpty(_rafManager.GetStringValue(data, "Data", "ExtraSpell" + i)))
                {
                    break;
                }

                ExtraSpells.Add(_rafManager.GetStringValue(data, "Data", "ExtraSpell" + i));
            }

            IsMelee         = _rafManager.GetBoolValue(data, "Data", "IsMelee");
            CollisionRadius = _rafManager.GetIntValue(data, "Data", "PathfindingCollisionRadius");

            JObject autoAttack;

            if (_rafManager.ReadAutoAttackData(model, out autoAttack))
            {
                AutoAttackDelay           = _rafManager.GetFloatValue(autoAttack, "SpellData", "CastFrame") / 30.0f;
                AutoAttackProjectileSpeed = _rafManager.GetFloatValue(autoAttack, "SpellData", "MissileSpeed");
            }

            LoadLua();
            foreach (var spell in Spells.Values)
            {
                spell.LoadExtraSpells(this);
            }
        }
Пример #10
0
        public Champion(Game game,
                        string model,
                        uint playerId,
                        uint playerTeamSpecialId,
                        RuneCollection runeList,
                        ClientInfo clientInfo,
                        uint netId = 0)
            : base(game, model, new Stats.Stats(), 30, 0, 0, 1200, netId)
        {
            _playerId            = playerId;
            _playerTeamSpecialId = playerTeamSpecialId;
            RuneList             = runeList;

            Inventory = InventoryManager.CreateInventory();
            Shop      = Shop.CreateShop(this, game);

            Stats.Gold = _game.Map.MapGameScript.StartingGold;
            Stats.GoldPerSecond.BaseValue = _game.Map.MapGameScript.GoldPerSecond;
            Stats.IsGeneratingGold        = false;

            //TODO: automaticaly rise spell levels with CharData.SpellLevelsUp

            for (short i = 0; i < CharData.SpellNames.Length; i++)
            {
                if (!string.IsNullOrEmpty(CharData.SpellNames[i]))
                {
                    Spells[i] = new Spell(game, this, CharData.SpellNames[i], (byte)i);
                }
            }

            Spells[4] = new Spell(game, this, clientInfo.SummonerSkills[0], 4);
            Spells[5] = new Spell(game, this, clientInfo.SummonerSkills[1], 5);

            for (byte i = 6; i < 13; i++)
            {
                Spells[i] = new Spell(game, this, "BaseSpell", i);
            }

            Spells[13] = new Spell(game, this, "Recall", 13);

            for (short i = 0; i < CharData.Passives.Length; i++)
            {
                if (!string.IsNullOrEmpty(CharData.Passives[i].PassiveLuaName))
                {
                    Spells[(byte)(i + 14)] = new Spell(game, this, CharData.Passives[i].PassiveLuaName, (byte)(i + 14));
                }
            }

            for (short i = 0; i < CharData.ExtraSpells.Length; i++)
            {
                if (!string.IsNullOrEmpty(CharData.ExtraSpells[i]))
                {
                    var spell = new Spell(game, this, CharData.ExtraSpells[i], (byte)(i + 45));
                    Spells[(byte)(i + 45)] = spell;
                    spell.LevelUp();
                }
            }

            Spells[4].LevelUp();
            Spells[5].LevelUp();
            Replication = new ReplicationHero(this);
            Stats.SetSpellEnabled(13, true);
        }
Пример #11
0
        public void InitRoomFeatures(RuneCollection runes)
        {
            // Generate a password for the escape portal
            var pwdGenerator         = new PasswordGenerator();
            var escapePortalPassword = pwdGenerator.GetPassword();

            // Create a rune for each password hint and add them
            // to a list that can be passed around to distribute
            // runes throughout the maze
            int runeNum = 1;

            foreach (var curHint in escapePortalPassword.Hints)
            {
                var runeName = this.GenerateRuneName(runeNum);
                runes.Add(new Rune(this.consoleOut, this.soundPlayer, runeName, curHint));
                runeNum = runeNum + 1;
            }

            var poisonpool = new PoisonPool();

            this.RoomFeatures.Add(poisonpool);
            var curRoom = this.PickRandomRoom();

            curRoom.Features.Add(poisonpool);

            var pool1 = new WaterPool(this.consoleOut, this.soundPlayer);

            this.RoomFeatures.Add(pool1);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(pool1);

            var pool2 = new WaterPool(this.consoleOut, this.soundPlayer);

            this.RoomFeatures.Add(pool2);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(pool2);

            var pool3 = new WaterPool(this.consoleOut, this.soundPlayer);

            this.RoomFeatures.Add(pool3);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(pool3);

            var pool4 = new WaterPool(this.consoleOut, this.soundPlayer);

            this.RoomFeatures.Add(pool4);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(pool4);

            var treasureChest1 = new TreasureChest(this.consoleOut, this.soundPlayer, 10);

            this.RoomFeatures.Add(treasureChest1);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(treasureChest1);

            var treasureChest2 = new TreasureChest(this.consoleOut, this.soundPlayer, 25);

            this.RoomFeatures.Add(treasureChest2);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(treasureChest2);

            var treasureChest3 = new TreasureChest(this.consoleOut, this.soundPlayer, 15);

            this.RoomFeatures.Add(treasureChest3);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(treasureChest3);

            var skeleton = new Skeleton(runes.UseNext());

            this.RoomFeatures.Add(skeleton);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(skeleton);

            var startPortal = new Portal(this.userPrompt,
                                         "Portal",
                                         "A portal that leads somewhere - hopefully better than your current location!",
                                         this.StartPosition,
                                         null,
                                         0);

            this.RoomFeatures.Add(startPortal);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(startPortal);

            var escapePortal = new Portal(this.userPrompt,
                                          "Escape Portal",
                                          "The only way out of this hellish maze. Hope you have the right password!",
                                          GameBoard.Position.Undefined,
                                          escapePortalPassword,
                                          3);

            this.RoomFeatures.Add(escapePortal);
            curRoom = this.PickRandomRoom();
            curRoom.Features.Add(escapePortal);
        }