示例#1
0
        public void SimulateGame()
        {
            IHero    hero    = HeroFactory.CreateHero();
            IMonster monster = MonsterFactory.CreateMonster();

            while (!hero.IsDead && !monster.IsDead)
            {
                var rng = new Random();
                int num = rng.Next(0, 100);

                if (num < 50)
                {
                    var w = hero.ActiveWeapon;
                    monster.SubtractHealth(w.Damage);

                    Console.WriteLine($"'{hero.Name}' je napao/la žrtvu '{monster.Name}' pomoću oružja '{w.Name}'");
                }
                else
                {
                    var attack = monster.AttackTypes[rng.Next(0, monster.AttackTypes.Length)];
                    hero.SubtractHealth(attack.Damage);

                    Console.WriteLine($"'{monster.GetType().Name}' je napao/la '{hero.GetType().Name}' pomoću oružja '{attack.Name}'");
                }
            }

            if (hero.IsDead)
            {
                Console.WriteLine($"'{hero.Name}' je pobedio/la u duelu sa '{monster.Name}'");
            }
            else
            {
                Console.WriteLine($"'{monster.Name}' je pobedio/la u duelu sa '{hero.Name}'");
            }
        }
示例#2
0
        public Controler(IfrmMain view)
        {
            timer          = new Timer();
            timer.Enabled  = true;
            timer.Tick    += new EventHandler(test);
            timer.Interval = 20;

            View = view;


            User能力  = new Game_User能力(View);
            特效      = new 傷害特效_2();
            Monster = new monster(View, this, User能力);
            傷害數字    = new Game_傷害數字();

            子彈   = new Game_子彈(this, 特效);
            Auto = new Game_AutoAttack(子彈, User能力, 特效);
            hit  = new Game_Hit(View, Monster, 子彈, User能力, 傷害數字, 特效);

            繪圖Action = new _繪圖(View, 傷害數字, Monster, 子彈, 特效, User能力);
            /* 以下為建立Test用*/
            //form2 = new Test();

            //form2.Visible = true;
            /* 以上為建立Test用*/
            // information = user;



            View.Set_Level = "目前等級為: " + User能力.Get_Set_level + "等!";
        }
示例#3
0
文件: Game.cs 项目: Nitboy/RPGBase
 public IEncounter CreateNewEncounter()
 {
     player = CharacterFactory.CreatePlayerCharacter();
     monster = CharacterFactory.CreateMonster();
     encounter = new Encounter(player, monster);
     return encounter;
 }
示例#4
0
文件: Engine.cs 项目: krasi070/Cycle
        private void MovePlayer(IPlayer player, IArea area, IMonster monster)
        {
            if (!player.IsInBattle)
            {
                player.Draw();

                ConsoleKey pressedKey = Console.ReadKey(true).Key;
                while (true)
                {
                    player.Move(pressedKey, area.BorderCoordinates);
                    int code = this.CheckIfPlayerLeftArea(player, area);
                    if (code != CodeForStay)
                    {
                        this.AreaNumber++;
                        this.LoadArea(player, code, true);
                    }

                    bool collideWithMonster = this.CheckIfPlayerCollidedWithMonster(player, monster);
                    if (collideWithMonster)
                    {
                        this.StartBattleMode(player, monster, area);
                        this.Battle(player, monster, area);
                    }

                    if (pressedKey == IncreaseStatusKey)
                    {
                        this.OpenIncreaseStatusScreen(player, area, monster, Option.First, true);
                    }

                    pressedKey = Console.ReadKey(true).Key;
                }
            }
        }
    void SpawningMonsters()
    {
        if (GameController.levelProps[LevelProps.levelCurr - 1].startNumberOfMonsters == currNum || !GameController.playerAlive)
        {
            CancelInvoke("SpawningMonsters");
        }
        else
        {
            //if (OnSpawn != null) {
            //	OnSpawn ();
            //}

            // Position spawn
            Vector3 pos = new Vector3(Random.Range(gameObject.transform.position.x - GameController.spawnMonstersRadius,
                                                   gameObject.transform.position.x + GameController.spawnMonstersRadius), // random x
                                      3,
                                      Random.Range(gameObject.transform.position.z - GameController.spawnMonstersRadius,  // random y
                                                   gameObject.transform.position.z + GameController.spawnMonstersRadius));

            GameObject go = Instantiate(monstersPref, pos, Quaternion.identity) as GameObject;

            //Random color
            IMonster monster = go.GetComponent <IMonster> ();
            int      c       = Random.Range(0, 5);
            monster.SetColor(GameController.colors [GameController.colorsStringArray [c]]);
            currNum++;
        }
    }
    public IEnumerable ItIgnoresZeroAndNegativeDamage()
    {
        IMonster          monster    = GetMonsterMock();
        MonsterController controller = GetControllerMock(monster);

        controller = SetWithSingleWaypoint(controller, monster);

        //zero
        controller.GetDamage(0);

        monster.DidNotReceiveWithAnyArgs().ChangeHealthBar(0.1f);
        monster.DidNotReceiveWithAnyArgs().Die(10);

        yield return(null);

        monster.DidNotReceiveWithAnyArgs().ChangeColor(Color.black);

        //negative
        controller.GetDamage(-100);

        monster.DidNotReceiveWithAnyArgs().ChangeHealthBar(0.1f);
        monster.DidNotReceiveWithAnyArgs().Die(10);

        yield return(null);

        monster.DidNotReceiveWithAnyArgs().ChangeColor(Color.black);
    }
示例#7
0
 public static void DetermineAliveProprerty(IMonster monster)
 {
     if (monster.HealthPoints <= 0)
     {
         monster.IsAlive = false;
     }
 }
        public static void OnMonsterHit(IMonster monster, Pipliz.Box <float> box)
        {
            var ps = PlayerState.GetPlayerState(monster.OriginalGoal);

            box.Set(box.item1 - (box.item1 * ps.Difficulty.MonsterDamageReduction));
            ServerManager.SendAudio(monster.Position, GameLoader.NAMESPACE + "ZombieAudio");
        }
示例#9
0
        public void AddSpellMissile(IMonster target, ISpell spell, Point mouse, string effect)
        {
            BasicMissileControler controler = new SpellTraceMissileControler((LiveMonster)target, spell);
            Missile mi = new Missile(effect, mouse.X, mouse.Y, controler);

            BattleManager.Instance.MissileQueue.Add(mi);
        }
示例#10
0
        public void AddCardReason(IMonster mon, AddCardReason reason)
        {
            string effName = "";

            switch (reason)
            {
            case Frag.AddCardReason.DrawCardBySkillOrSpell:
                effName = "flycard";
                break;

            case Frag.AddCardReason.GetCertainCard:
                goto case Frag.AddCardReason.DrawCardBySkillOrSpell;

            case Frag.AddCardReason.Discover:
                effName = "flycard2";
                break;

            case Frag.AddCardReason.RandomCard:
                effName = "flycard3";
                break;
            }

            if (IsLeft && !string.IsNullOrEmpty(effName))
            {
                Point startPoint = new Point(BattleManager.Instance.MemMap.StageWidth / 2, BattleManager.Instance.MemMap.StageHeight / 2);
                if (mon != null)
                {
                    startPoint = mon.Position;
                }
                BattleManager.Instance.EffectQueue.Add(new UIEffect(EffectBook.GetEffect(effName), startPoint,
                                                                    new Point(BattleManager.Instance.MemMap.StageWidth / 2, BattleManager.Instance.MemMap.StageHeight), 16, true));
            }
        }
示例#11
0
 public virtual void Check(Hero request, IMonster monster)
 {
     if (nextCheck != null)
     {
         nextCheck.Check(request, monster);
     }
 }
示例#12
0
        public void AddMissile(IMonster target, string arrow)
        {
            BasicMissileControler controler = new TraceMissileControler(this, target as LiveMonster);
            Missile mi = new Missile(arrow, Position.X, Position.Y, controler);

            BattleManager.Instance.MissileQueue.Add(mi);
        }
示例#13
0
        /// <summary>
        /// The fighting process itself. Starts with the hero taking the first hit.
        /// </summary>
        /// <param name="monster">The monster that our player fights against.</param>
        public void Fight(IMonster monster)
        {
            this.Fights++;

            double damageDone = this.Hero.Hit(monster);

            this.Logger.Add($"The {this.Hero.GetType().Name} hits the {monster.GetType().Name} dealing {damageDone} damage to it.");

            if (monster.IsDead())
            {
                this.Hero.GainExperience(monster.Experience());
                this.Logger.Add($"The monster dies. ({monster.Experience()} XP gained.)");
                return;
            }

            double monsterDamageDone = monster.Hit(this.Hero);

            this.Logger.Add($"The {monster.GetType().Name} hits the {this.Hero.GetType().Name} dealing {monsterDamageDone} damage to it.");

            if (this.Hero.IsDead())
            {
                this.Hero.Heal();
                this.HealsUsed++;

                if (this.HealsUsed > 3)
                {
                    this.Logger.Add($"The hero dies on level {this.Hero.Level} after {this.Fights} fights.");
                    return;
                }

                this.Logger.Add($"The hero has taken fatal damage. Luckily he has managed to heal just before he dies.");
            }

            this.Fight(monster);
        }
示例#14
0
 private static void MonsterAttack(IMonster monster, Skill attack)
 {
     Console.WriteLine();
     Console.WriteLine("**************************************");
     Console.WriteLine($"{monster.Name} used {attack.Name} for {attack.Damage} damage");
     Console.WriteLine("**************************************");
 }
示例#15
0
        public void Paint(WorldLayer layer, IMonster monster)
        {
            // rift progression per time to kill
            var    rp   = monster.SnoMonster.RiftProgression / monster.CurHealth * Hud.Game.Me.Damage.RunDps / Hud.Game.MaxQuestProgress * 1000;
            string text = rp.ToString("0");

            if (monster.IsElite && monster.SummonerAcdDynamicId == 0)             // no minions
            {
                Decorators["blue"].Paint(layer, monster, text);
            }
            else if (rp < 25)
            {
                Decorators["red"].Paint(layer, monster, text);
            }
            else if (rp < 100)
            {
                Decorators["orange"].Paint(layer, monster, text);
            }
            else if (rp < 250)
            {
                Decorators["yellow"].Paint(layer, monster, text);
            }
            else
            {
                Decorators["green"].Paint(layer, monster, text);
            }
        }
        public static void OnMonsterSpawned(IMonster monster)
        {
            var cs = Entities.ColonyState.GetColonyState(monster.OriginalGoal);

            var fi = monster.CurrentHealth;

            float hpBonus = monster.OriginalGoal.FollowerCount * cs.Difficulty.MonsterHPPerColonist;

            if (MonsterManager.BossActive && MonsterManager.SpawnedBosses.TryGetValue(cs, out var boss) && boss != null && boss.ZombieHPBonus != 0)
            {
                hpBonus += boss.ZombieHPBonus;
            }

            monster.CurrentHealth = monster.CurrentHealth + hpBonus;
            monster.TotalHealth   = monster.CurrentHealth + hpBonus;

            if (!MonsterCount.ContainsKey(monster.OriginalGoal))
            {
                MonsterCount.Add(monster.OriginalGoal, 1);
            }
            else
            {
                MonsterCount[monster.OriginalGoal] = MonsterCount[monster.OriginalGoal] + 1;
            }
        }
示例#17
0
        private bool isKrysbin(IMonster Mob)
        {
            var  Players  = Hud.Game.Players.Where(player => player.HeroClassDefinition.HeroClass == HeroClass.Necromancer);
            bool EKrysbin = false;

            foreach (var player in Players)
            {
                if (player.Powers.BuffIsActive(475241))
                {
                    EKrysbin = true;
                    break;
                }
            }
            if (!EKrysbin)
            {
                return(false);
            }
            if (Mob.Slow || Mob.Chilled)
            {
                if (Mob.Frozen || Mob.Stunned || Mob.Blind)
                {
                    return(true);
                }
            }

            return(false);
        }
示例#18
0
        public Game(IMonsterFactory factory)
        {
            gamer = new Hero(); // герой, за которого играем

            //Список комнат в локации
            Room[] rooms = new Room[]
            {
                new Room(),
                new Room(),
                new Room()
            };

            //Список сокровищ в локации
            Treasure[] treasures = new Treasure[]
            {
                new Treasure(),
                new Treasure(),
                new Treasure()
            };

            IMonster[] monsters = new IMonster[50]; // Список монстров в локации

            for (int i = 0; i < monsters.Length; i++)
            {
                monsters[i] = factory.Create(); // задаем тип монстра
            }

            location = new Dangeon(monsters, rooms, treasures); // инициализация игровой локации
        }
 public void MonsterDied(IMonster monster)
 {
     if (MonsterCount.ContainsKey(monster.OriginalGoal))
     {
         MonsterCount[monster.OriginalGoal] = MonsterCount[monster.OriginalGoal] - 1;
     }
 }
示例#20
0
        public static void OnUpdate()
        {
            if (!World.Initialized)
            {
                return;
            }

            var secondsSinceStartDouble = Pipliz.Time.SecondsSinceStartDouble;

            if (_nextUpdateTime < secondsSinceStartDouble)
            {
                IMonster m = null;

                foreach (var monster in MonsterManager.GetAllMonsters())
                {
                    if (m == null || UnityEngine.Vector3.Distance(monster.Value.Position, m.Position) > 15 && Pipliz.Random.NextBool())
                    {
                        m = monster.Value;
                        AudioManager.SendAudio(monster.Value.Position, GameLoader.NAMESPACE + ".ZombieAudio");
                    }
                }

                _nextUpdateTime = secondsSinceStartDouble + 5;
            }
        }
示例#21
0
        public override void MonsterGetsAggravated(IMonster monster, bool printFinalNewLine = true)
        {
            Debug.Assert(monster != null);

            var room = monster.GetInRoom();

            Debug.Assert(room != null);

            // Fido wakes up

            if (monster.Uid == 11 && gGameState.FidoSleepCounter > 0)
            {
                gOut.Print("{0} wakes up!", room.IsLit() ? "Fido" : "Something");

                gGameState.FidoSleepCounter = 0;

                monster.StateDesc = "";

                monster.Reaction = Friendliness.Enemy;
            }
            else
            {
                base.MonsterGetsAggravated(monster, printFinalNewLine);
            }
        }
        public void DrawAffixNames(IMonster monster, IList <DangerousAffixMonsterDefinition> affixes, string combinedNames)
        {
            // get an estimation of combined labels size
            var first = affixes.FirstOrDefault();

            if (first == null)
            {
                return;
            }

            var firstFont      = monster.Rarity == ActorRarity.RareMinion ? first.MinionLabelFont : first.EliteLabelFont;
            var combinedLayout = firstFont.GetTextLayout(combinedNames);
            var spacerLayout   = firstFont.GetTextLayout(":");
            var offsetX        = -combinedLayout.Metrics.Width / 2;

            foreach (var affix in affixes)
            {
                var font = monster.Rarity == ActorRarity.RareMinion ? affix.MinionLabelFont : affix.EliteLabelFont;
                var text = affix.AffixName ?? (affix.AffixName = affix.AffixNameFunc.Invoke(monster.AffixSnoList.First(snoa => snoa.Affix == affix.Affix)));

                if (string.IsNullOrWhiteSpace(text))
                {
                    continue;
                }

                var   layout = font.GetTextLayout(text);
                float mapX, mapY;
                Hud.Render.GetMinimapCoordinates(monster.FloorCoordinate.X, monster.FloorCoordinate.Y, out mapX, out mapY);

                font.DrawText(layout, mapX + offsetX, mapY);
                offsetX += layout.Metrics.Width + spacerLayout.Metrics.Width;
            }
        }
示例#23
0
 public void DealDamageTo(IMonster monster)
 {
     if (Level > 0)
     {
         monster.DoDamage(Dps);
     }
 }
示例#24
0
        public virtual AttackResult Attack(IMonster target)
        {
            bool isHit = false;
            int damage = 0;

            // Let's do some placeholder logic for calculating damage.
            double dexDiff = (this.Dexterity - target.Dexterity) / 10.0;

            isHit = Game.Current.RNG.NextDouble() < (BaseToHitChance + dexDiff);

            if(isHit)
            {
                damage = BaseDamage + (this.Strength - target.Constitution);

                damage += Game.Current.RNG.Next(-2, 2);

                AttackResult result = new AttackResult(isHit, damage);

                target.TakeDamage(result);

                return result;
            }
            else
            {
                return AttackResult.Miss;
            }
        }
示例#25
0
 public static void OnMonsterHit(IMonster monster, ModLoader.OnHitData d)
 {
     if (Pipliz.Random.NextFloat() > .5f)
     {
         AudioManager.SendAudio(monster.Position, GameLoader.NAMESPACE + ".ZombieAudio");
     }
 }
示例#26
0
        public override void MonsterDies(IMonster OfMonster, IMonster DfMonster)
        {
            base.MonsterDies(OfMonster, DfMonster);

            if (OfMonster != null && OfMonster.Uid == gGameState.Cm)
            {
                // If player kills Mirabelle, Jollifrud gets angry and vice versa

                if (DfMonster.Uid == 20 || DfMonster.Uid == 26)
                {
                    var monster = gMDB[DfMonster.Uid == 20 ? 26 : 20];

                    Debug.Assert(monster != null);

                    if (monster.Reaction > Friendliness.Enemy)
                    {
                        gOut.WriteLine();
                    }

                    while (monster.Reaction > Friendliness.Enemy)
                    {
                        base.MonsterGetsAggravated(monster, false);
                    }
                }
            }
        }
示例#27
0
        public override void MonsterDies(IMonster OfMonster, IMonster DfMonster)
        {
            Debug.Assert(DfMonster != null && !DfMonster.IsCharacterMonster());

            // Repetitive Spooks' counter reset

            if (DfMonster.Uid == 9)
            {
                var resetGroupCount = DfMonster.CurrGroupCount == 1;

                base.MonsterDies(OfMonster, DfMonster);

                if (resetGroupCount)
                {
                    DfMonster.GroupCount = 0;

                    DfMonster.InitGroupCount = 0;

                    DfMonster.CurrGroupCount = 0;
                }
            }
            else
            {
                base.MonsterDies(OfMonster, DfMonster);
            }
        }
示例#28
0
        private void PaintFloorLines(IEnumerable <IMonster> monsters, IBrush brush)
        {
            var      lastCenter = Hud.Game.Me.FloorCoordinate;
            var      list       = new List <IMonster>(monsters);
            IMonster nearest    = null;

            foreach (var monster in list)
            {
                if (nearest == null || monster.CentralXyDistanceToMe < nearest.CentralXyDistanceToMe)
                {
                    nearest = monster;
                }
            }
            list.Remove(nearest);
            while (list.Count > 0)
            {
                IMonster nextNearest = null;
                foreach (var monster in list)
                {
                    if (nextNearest == null || monster.FloorCoordinate.XYDistanceTo(nearest.FloorCoordinate) < nextNearest.FloorCoordinate.XYDistanceTo(nearest.FloorCoordinate))
                    {
                        nextNearest = monster;
                    }
                }

                brush.DrawLineWorld(nearest.FloorCoordinate, nextNearest.FloorCoordinate);
                nearest = nextNearest;
                list.Remove(nextNearest);
            }
        }
        private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            var    w      = m.CurHealth * w2 / m.MaxHealth;
            var    per    = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%");
            var    y      = YPos + py * 8 * yref;
            IBrush cBrush = null;
            IFont  cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }


            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 1.0f;
        }
示例#30
0
        public override void MonsterGetsAggravated(IMonster monster, bool printFinalNewLine = true)
        {
            Debug.Assert(monster != null);

            // Keep Pookas Neutral

            if (monster.Uid > 3)
            {
                base.MonsterGetsAggravated(monster, printFinalNewLine);

                // Sync friendliness of Commander & troops, Prince & Guards

                if (monster.Uid == 27 || monster.Uid == 28)
                {
                    var monster01 = gMDB[monster.Uid == 27 ? 28 : 27];

                    Debug.Assert(monster01 != null);

                    base.MonsterGetsAggravated(monster01, printFinalNewLine);
                }
                else if (monster.Uid == 38 || monster.Uid == 39)
                {
                    var monster01 = gMDB[monster.Uid == 38 ? 39 : 38];

                    Debug.Assert(monster01 != null);

                    base.MonsterGetsAggravated(monster01, printFinalNewLine);
                }
            }
        }
示例#31
0
        public override void MonsterDies(IMonster OfMonster, IMonster DfMonster)
        {
            Debug.Assert(DfMonster != null && !DfMonster.IsCharacterMonster());

            if (DfMonster.Uid == 8)
            {
                var trollsfireArtifact = gADB[10];

                Debug.Assert(trollsfireArtifact != null);

                var printEffect = trollsfireArtifact.IsCarriedByMonster(DfMonster) || trollsfireArtifact.IsWornByMonster(DfMonster);

                base.MonsterDies(OfMonster, DfMonster);

                if (printEffect)
                {
                    var effect = gEDB[3];

                    Debug.Assert(effect != null);

                    gOut.Write("{0}{0}{1}", Environment.NewLine, effect.Desc);
                }
            }
            else
            {
                base.MonsterDies(OfMonster, DfMonster);
            }
        }
示例#32
0
        public Encounter(ICharacter playerCharacter, IMonster monsterCharacter)
        {
            Events = new List<IEvent>();

            PlayerCharacter = playerCharacter;
            MonsterCharacter = monsterCharacter;

            Inititive = new Inititive();
            Inititive.Add(playerCharacter);
            Inititive.Add(monsterCharacter);

            this.LastEvent = string.Format("{0} has encountered a {1}.", playerCharacter.Name, monsterCharacter.Name);
        }
示例#33
0
 public void AddRandomCardJob(IMonster mon, int job, int lv)
 {
     var cardId = CardConfigManager.GetRandomJobCard(job);
     if (cardId != 0)
     {
         AddCard(mon, cardId, lv);
     }
 }
示例#34
0
 public void AddRandomCard(IMonster mon, int type, int lv)
 {
     int cardId = 0;
     switch (type)
     {
         case 1: cardId = MonsterBook.GetRandMonsterId();break;
         case 2: cardId = WeaponBook.GetRandWeaponId(); break;
         case 3: cardId = SpellBook.GetRandSpellId(); break;
     }
     AddCard(mon, cardId, lv);
 }
示例#35
0
 public void GetNextNCard(IMonster mon, int n)
 {
     if (IsLeft)
     {
         Point startPoint = new Point(BattleManager.Instance.MemMap.StageWidth / 2, BattleManager.Instance.MemMap.StageHeight / 2);
         if (mon != null)
             startPoint = mon.Position;
         BattleManager.Instance.EffectQueue.Add(new UIEffect(EffectBook.GetEffect("flycard"), startPoint, new Point(BattleManager.Instance.MemMap.StageWidth / 2, BattleManager.Instance.MemMap.StageHeight), 16, true));
     }
     CardManager.GetNextNCard(n);
 }
示例#36
0
 private bool MonsterDoDamage(Random rnd, IMonster monster, bool check)
 {
     int dmg;
     dmg = this.MonsterHit(core.Hero, rnd.Next((int) monster.DamageMin, (int) monster.DamageMax + 1));
     DrawScreen.AddLineToBuffer(ref battleArea2,
         "Monster hitted you for " + (dmg - (core.Hero.Armor*core.Hero.ArmorRed)) + " amount of damage!");
     if (core.Hero.Health <= 0)
     {
         DrawScreen.AddLineToBuffer(ref battleArea2, "Game Over! You have been defeated.");
         this.UpdateHpBar(core.Hero, monster);
         DrawScreen.drawScreen(battleArea1, battleArea2);
         Environment.Exit(0);
         //check = false;
     }
     else
     {
         this.UpdateHpBar(core.Hero, monster);
     }
     return check;
 }
示例#37
0
 private void FillArea(Hero hero, IMonster monster)
 {
     DrawScreen.AddLineToBuffer(ref battleArea1, Environment.NewLine);
     DrawScreen.AddLineToBuffer(ref battleArea1,
         " ".PadLeft(4, ' ') + hero.Name.PadRight(50, ' ') + monster.ToString());
     DrawScreen.AddLineToBuffer(ref battleArea1,
         " ".PadLeft(4, ' ') + ("Damage " + hero.DamageMin + " - " + hero.DamageMax).PadRight(50, ' ') + "Damage " + monster.DamageMin + " - " + monster.DamageMax);
     DrawScreen.AddLineToBuffer(ref battleArea1,
         " ".PadLeft(4, ' ') + ("HP: " + hero.Health).PadRight(50, ' ') + "HP: " + monster.Health);
     DrawScreen.AddLineToBuffer(ref battleArea1,
         " ".PadLeft(4, ' ') + ("LVL: " + hero.Level).PadRight(50, ' ') + "LVL: " + monster.Level);
     for (int i = 0; i < 2; i++)
     {
         DrawScreen.AddLineToBuffer(ref battleArea1, Environment.NewLine);
     }
     DrawScreen.AddLineToBuffer(ref battleArea1, new string('-', 90));
 }
示例#38
0
 private void UpdateHpBar(Hero hero, IMonster monster)
 {
     var i = battleArea1.FindIndex(x => x.Contains("HP:"));
     battleArea1[i] = " ".PadLeft(4, ' ') + ("HP: " + hero.Health).PadRight(50, ' ') + "HP: " + monster.Health;
 }
示例#39
0
 private int HeroHit(ref IMonster monster, int damage)
 {
     monster.Health -= damage;
     if (monster.Health < 0) monster.Health = 0;
     return damage;
 }
示例#40
0
 public void AddRandomCardRace(IMonster mon, int race, int lv)
 {
     var cardId = CardConfigManager.GetRandomRaceCard(race);
     if (cardId != 0)
     {
         AddCard(mon, cardId, lv);
     }
 }
示例#41
0
    public string ItsaAngel(IMonster angel)
    {
        if(angel.Level > 0.33 * defence)
        {
            return (mechName + " Lost in Battle.\n");
        }
        else
        {
            return (mechName + " Continues the fight.\n");
        }

        if (angel.Level > 0.25 * attack)
        {
            return (mechName + "'s Attacks did nothing.\n");
        }
        else
        {
            return (mechName + " Defeated the monster.\n");
        }
    }
示例#42
0
 private bool BattleEnd(IMonster monster, bool check, double monsterMaxHealth)
 {
     DrawScreen.AddLineToBuffer(ref battleArea2, "Monster is dead!!");
     core.Hero.Exp += monster.ExpirienceReward;
     core.Hero.Gold += monster.GoldReward;
     DrawScreen.AddLineToBuffer(ref battleArea2,
         "You earned " + monster.ExpirienceReward + " Exp, and " + monster.GoldReward + " gold.");
     monster.Health = 0;
     this.UpdateHpBar(core.Hero, monster);
     try
     {
         var item = core.LootRandomItem();
         DrawScreen.AddLineToBuffer(ref battleArea2, item.Id);
     }
     catch (ArgumentException e)
     {
         DrawScreen.AddLineToBuffer(ref battleArea2, e.Message);
     }
     check = false;
     monster.Health = monsterMaxHealth;
     return check;
 }
示例#43
0
 public void ReviveUnit(IPlayer player, IMonster mon, int addHp)
 {
     LiveMonster lm = mon as LiveMonster;
     lm.Revive();
     lm.DeleteWeapon();
     lm.Life += addHp;
     if (lm.Owner != player)//复活了对方的怪,就招过来了
     {
         lm.Rebel();
     }
 }
示例#44
0
 public void StealWeapon(IMonster target)
 {
     var monster = target as LiveMonster;
     if (monster != null)
     {
         var weapon = monster.Weapon;
         AddWeapon(weapon);
         target.BreakWeapon();
     }
 }
        public void Fight(IMonster monster)
        {
            var damageToMonster = rnd.Next(AttackPoints) - rnd.Next(monster.DefensePoints);
            if(damageToMonster > 0)
                monster.TakeHit(damageToMonster);
            if (monster.IsDead)
            {
                Gold += monster.Gold;
                return;
            }

            var damageToCharacter = rnd.Next(monster.AttackPoints) - rnd.Next(DefensePoints);
            if(damageToCharacter > 0)
                Health -= damageToCharacter;
        }
示例#46
0
 public void OnMagicDamage(IMonster source, double damage, int element)
 {
     var dam = new HitDamage((int) damage, (int) damage, element, DamageTypes.Magic);
     Life -= SkillAssistant.GetMagicDamage(this, dam);
     lastDamagerId = source == null ? 0 : source.Id;
     OnDamage(dam);
 }
示例#47
0
 public void EatTomb(IMonster tomb)
 {
     Atk.Source *= 1.1;
     AddMaxHp(MaxHp.Source*0.1);
     (tomb as LiveMonster).Disappear();
 }
示例#48
0
 private Image GetImageForMonster(IMonster m)
 {
     Image i = new Image();
     switch (m.BaseType)
     {
         case "Wolf":
             i.Source = m_images["Wolf"].Source;
             break;
         case "Orc Barbarian":
             i.Source = m_images["Orc"].Source;
             break;
         case "Orc Warrior":
             i.Source = m_images["Orc Knight"].Source;
             break;
         case "Goblin Healer":
             i.Source = m_images["Goblin"].Source;
             break;
         case "Goblin Slinger":
             i.Source = m_images["Hobgoblin"].Source;
             break;
         case "Kobold":
             i.Source = m_images["Kobold"].Source;
             break;
         case "Giant Rat":
             i.Source = m_images["Rat"].Source;
             break;
         default:
             throw new InvalidOperationException("GetImageForMonster - can't find image for: " + m.BaseType);
     }
     return i;
 }
示例#49
0
 public void AddMissile(IMonster target, string arrow)
 {
     BasicMissileControler controler = new TraceMissileControler(this, target as LiveMonster);
     Missile mi = new Missile(arrow, Position.X, Position.Y, controler);
     BattleManager.Instance.MissileQueue.Add(mi);
 }
 public GoUpTheMountainOfDoomTask(IExecutableTask originalTask)
 {
     this.originalTask = originalTask;
     monster = new NonCodingArchitect();
 }
示例#51
0
        public void ExchangeMonster(IMonster target, int lv)
        {
            if ((target as LiveMonster).Avatar.MonsterConfig.IsBuilding)
            {
                BattleManager.Instance.FlowWordQueue.Add(new FlowWord("抵抗", target.Position, 0, "Gold", 26, 0, 0, 1, 15), false);
                return;
            }

            target.Transform(MonsterBook.GetRandMonsterId());
        }
示例#52
0
 public void AddSpellMissile(IMonster target, ISpell spell, Point mouse, string effect)
 {
     BasicMissileControler controler = new SpellTraceMissileControler((LiveMonster)target, spell);
     Missile mi = new Missile(effect, mouse.X, mouse.Y, controler);
     BattleManager.Instance.MissileQueue.Add(mi);
 }
示例#53
0
 public void DealDamage(IMonster monster)
 {
     monster.Health -= this.Attack - monster.Defence;
 }
示例#54
0
 public void AddCard(IMonster mon, int cardId, int level)
 {
     CardManager.AddCard(cardId, level);
 }
示例#55
0
        public void AddMana(IMonster mon, int type, double addon)
        {
            AddManaData((PlayerManaTypes)type, (int)addon);

            if (addon > 0)
            {
                List<PlayerManaTypes> addonList = new List<PlayerManaTypes>();
                for (int i = 0; i < addon; i++)
                {
                    addonList.Add((PlayerManaTypes)type);
                }
                BattleManager.Instance.FlowWordQueue.Add(new FlowManaInfo(addonList, mon.Position, 0, 40), true);
            }
        }
示例#56
0
 public void ItsAnAngel(IMonster angel)
 {
     if (angel.Level > Defense / 3)
     {
         Console.WriteLine(MechName + " lost in battle.");
     }
     else
     {
         Console.WriteLine(MechName + " continues the fight.");
     }
     if (angel.Level > Attack / 4)
     {
         Console.WriteLine(MechName + "'s attacks did nothing.");
     }
     else
     {
         Console.WriteLine(MechName + " defeated the monster.");
     }
 }
示例#57
0
 private void ScreenUpdate(Hero hero, IMonster monster)
 {
     this.FillArea(hero, monster);
     this.CommandsShow();
     this.CombineArea();
 }
 public AttackTask(IMonster monster, IExecutableTask originalTask)
 {
     this.monster = monster;
     this.originalTask = originalTask;
 }