Ejemplo n.º 1
0
 public void AddCombatGroup(GameObject entity, CombatGroup combatGroup)
 {
     if (!combatGroups.ContainsKey(combatGroup))
     {
         combatGroups[combatGroup] = entity;
     }
 }
        public override void CastAt(CombatGroup targets, Entity caster)
        {
            if (Type.DidFizzle(caster))
            {
                caster.PushUIString(caster.Name + " fizzled " + Name);
                return;
            }

            if (caster.RemoveMana(ManaCost))
            {
                IList<Entity> actualTargets;
                if (targets.Players.Contains(targets.Target))
                {
                    actualTargets = targets.Players;
                }
                else
                {
                    actualTargets = targets.Monsters;
                }
                int damage = GetDamage(caster);
                foreach (Entity e in actualTargets)
                {
                    e.RemoveHP(damage);
                    caster.PushUIString(caster.Name + " did " + damage + " damage to " + e.Name);
                }
            }
        }
        public override void CastAt(CombatGroup targets, Entity caster)
        {
            if (Type.DidFizzle(caster))
            {
                caster.PushUIString(caster.Name + " fizzled " + Name);
                return;
            }

            if (caster.RemoveMana(ManaCost))
            {
                int damage = GetDamage(caster);
                targets.Target.RemoveHP(damage);
                caster.PushUIString(caster.Name + " did " + damage + " damage to " + targets.Target.Name);
            }
        }
Ejemplo n.º 4
0
 public override UUID chooseBlockerOrder(List value1, CombatGroup value2, List value3, Game value4)
 {
     Debug.Log("Player - chooseBlockerOrder");
     return(null);
 }
        public virtual void GetTarget(CombatGroup targets)
        {
            int i = 1;
            Console.WriteLine("\r\nPlayer Party:");
            foreach(var e in targets.Players)
            {
                Console.WriteLine(i++ + ": " + e.Description);
            }

            Console.WriteLine("\r\nMonsters:");
            foreach(var e in targets.Monsters)
            {
                Console.WriteLine(i++ + ": " + e.Description);
            }
            Console.Write("Please enter the number corresponsing to your target: ");
            int selection = GetIntInRange(1, i-1) - 1;
            while (targets[selection].IsDead())
            {
                Console.Write("Please ensure your target is alive. ");
                selection = GetIntInRange(1, i-1) - 1;
            }
            targets.SetTarget(targets[selection]);
        }
 public override void Do(CombatGroup targets)
 {
     //TODO add item removal logic once Inventory is in place
     if (item.Apply(targets.Target))
         issuer.RemoveItem(item);
 }
Ejemplo n.º 7
0
        public CombatScreen(InterfaceManager manager)
            : base(manager)
        {
            backButton        = new Button(null, "Back", 1, 1);
            backButton.Click += (sender, e) => InterfaceManager.ChangeInterface("Travel");

            attackButton        = new Button(null, "Attack", 1, 4);
            attackButton.Click += (sender, e) =>
            {
                if (!shipList.HasSelection)
                {
                    return;
                }

                GameManager.CombatSimulator.SetCombatants(GameManager.PlayerShip, (Ship)shipList.GetSelection());
                CombatGroup victor = GameManager.CombatSimulator.SimulateCombat();
                updateDisplayInformation();

                descriptionBox.Text = string.Format("{0} won!", victor.Ships[0].Name);
            };

            scanButton        = new Button(null, "Scan", 1, 7);
            scanButton.Click += (sender, e) =>
            {
                if (!shipList.HasSelection)
                {
                    return;
                }

                GameManager.CombatSimulator.SetCombatants(GameManager.PlayerShip, (Ship)shipList.GetSelection());
                double oddsToWin = GameManager.CombatSimulator.GetCombatOdds();

                string text = string.Format("{0}% chance to win.\n-\n", oddsToWin * 100.0);

                if (GameManager.CombatSimulator.GroupTwo.Ships[0].CanBeScanned(GameManager.PlayerShip))
                {
                    //List the equipped modules
                    foreach (ShipNode node in GameManager.CombatSimulator.GroupTwo.Ships[0].Nodes)
                    {
                        if (node.Empty)
                        {
                            continue;
                        }
                        text += string.Format("{0} - {1}\n", node.ModType, node.Module.Name);
                    }

                    text += "-\n";

                    //List the carried items
                    List <InventorySlot> inventory = GameManager.CombatSimulator.GroupTwo.Ships[0].Inventory.GetInventoryList();
                    foreach (InventorySlot slot in inventory)
                    {
                        text += string.Format("{0} - #{1}\n", slot.Item.Name, slot.Quantity);
                    }
                }
                else
                {
                    text += "Cannot be scanned.";
                }

                descriptionBox.Text = text;
            };

            shipList           = new ScrollingList(null, GraphicConsole.BufferWidth - 41, 1, 40, 20);
            shipList.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            descriptionBox           = new TextBox(null, GraphicConsole.BufferWidth - 41, 22, 40, 14);
            descriptionBox.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            shipList.Selected += (sender, e) =>
            {
                descriptionBox.Text = getShipDescription((Ship)shipList.GetSelection());
                InterfaceManager.DrawStep();
            };

            RegisterControl(backButton);
            RegisterControl(attackButton);
            RegisterControl(scanButton);
            RegisterControl(shipList);
            RegisterControl(descriptionBox);
        }