Inheritance: MonoBehaviour
Exemple #1
0
    protected override void Start()
    {
        base.Start();
        CanAttack = true;

        CombatLog = CombatLog.Instance;
    }
Exemple #2
0
        public CombatLogBox(CombatLog Log,List<GuiItem> Garbage)
            : base("CombatLogBox")
        {
            this.Garbage = Garbage;
            Width = 250;
            Height = 200;
            this.Log = Log;
            MousePos = new Point();
            WinBar = new WindowBar("Combat Log", Width);
            WinBar.CloseButton = false;

            Background = new BackgroundItem(Color.WhiteSmoke);
            Background.Width = Width;
            Background.Height = Height;

            bOk = new ButtonItem("Ok", 120, 22, "Ok");
            bOk.Y = 170;
            bOk.X = (Width - bOk.Width) / 2;

            labelPhyDmg = new LabelItem("Physical Damage : "+Log.PhysicalDamage);

            labelMagDmg = new LabelItem("Magic Damage : " + Log.MagicDamage);

            labelCritDmg = new LabelItem("Critical Damage : " + Log.CriticalDamage);

            labelCritTimes = new LabelItem("Critical Times : " + Log.CriticalTimes);

            labelGoldStolen = new LabelItem("Gold Stolen : " + Log.GoldStolen);
        }
Exemple #3
0
 /// <summary>
 /// Should be called after damage is dealt to ensure a check is run for combat end.
 /// </summary>
 private void CheckForCombatEnd()
 {
     // Iterates through the combat queue to find if any new characters died.
     foreach (Character character in combatQueue)
     {
         bool isDead = character.CheckForDeath();
         if (isDead)
         {
             CombatLog.AddMessageToQueue(character.CharacterName + " has died!");
         }
     }
     // Checks to see if the combat end requiriments have been reached.
     if (combatQueue.Any(combatant => combatant.PlayerControlled && combatant.IsAlive))
     {
         if (combatQueue.Any(combatant => !combatant.PlayerControlled && combatant.IsAlive))
         {
             // Battle continues
             return;
         }
         else
         {
             // Victory
             EndCombat(true);
         }
     }
     else
     {
         // The party loses
         EndCombat(false);
     }
 }
Exemple #4
0
        private void DamageBoss(Enemy target, int damage)
        {
            if (BossBar.Value - damage <= 0)
            {
                if (bc.subbars == 0)
                {
                    BossBar.Value = 0;
                    CombatLog.AppendText($"{target.name} died!");
                    CombatLog.AppendText(Environment.NewLine);
                    CombatLog.AppendText(Environment.NewLine);

                    mm.StopBoss();
                    mm.SetBossSong(r.Next(1, d.tier));
                    mm.ResumeSong();

                    DungeonCheck();
                }
                else
                {
                    damage       -= damage - BossBar.Value;
                    BossBar.Value = bc.hp_default;
                    sbars[bc.subbars - 1].Value = 0;
                    bc.subbars--;
                    DamageBoss(target, damage);
                }
            }
            else
            {
                BossBar.Value -= damage;
            }
        }
Exemple #5
0
 public void LogSurvivors()
 {
     foreach (Indian member in IndiansAlive)
     {
         CombatLog.Save(member.Name + " survived with " + member.HitPoints + " hit points left");
     }
 }
Exemple #6
0
        private void UseSelectedSkill()
        {
            Skill s = Skills.SelectedItem as Skill;

            CombatLog.AppendText($"{p.Name} used {s.Name}");
            CombatLog.AppendText(Environment.NewLine);

            int h = r.Next(0, 100);

            if (h < 95)
            {
                try
                {
                    if (d.isBoss)
                    {
                        ReduceBar(BossBar, 0, s, BossName);
                    }
                    else
                    {
                        DealDamageToEnemies(s);
                    }
                }
                catch (Exception) { }
            }
            else
            {
                CombatLog.AppendText("The attack missed.");
                CombatLog.AppendText(Environment.NewLine);
                CombatLog.AppendText(Environment.NewLine);
                tp.Miss();
                CheckTurnPlayer();
            }
        }
Exemple #7
0
        private void CheckTurnPlayer()
        {
            if (tp.turnEnd)
            {
                // begin enemy turn
                IsPlayerTurn = false;
                tp           = new TurnPress(d.enemyTurns * 2);

                CombatLog.AppendText("Player turn over, it is now the enemy's turn.");
                CombatLog.AppendText(Environment.NewLine);
                CombatLog.AppendText(Environment.NewLine);

                TurnBox.Text = tp.PrintIcons();

                UseSkillButton.Enabled = false;
                UseItemButton.Enabled  = false;
                UseRelic.Enabled       = false;
                IsPlayerTurn           = false;

                if (!d.IsDungeonComplete())
                {
                    eTurn = 0;
                    timer.Start();
                }
            }
            else
            {
                TurnBox.Text = tp.PrintIcons();
            }
        }
Exemple #8
0
 public void LogSurvivors()
 {
     foreach (T member in MembersAlive)
     {
         CombatLog.Save($"{member.Name} survived with {member.HitPoints:F2} hit points left.");
     }
 }
Exemple #9
0
    public override void DoTask(NPC unit, Unit targetUnit = null, Tile targetTile = null)
    {
        //find a square to move to that isn't next to an enemy.
        if (unit.remainingMove > 0 && moved == false)
        {
            unit.FindSelectableTiles();
            List <Tile> tiles = RangeFinder.FindTilesNotNextToEnemy(unit, unit.selectableTiles, Factions.players);
            int         roll  = Random.Range(0, tiles.Count);
            if (tiles[roll] != null)
            {
                Initiative.queuedActions++;
                CombatLog.UpdateCombatLog(unit.name + " moves toward opposing faction.");
                unit.MoveToTile(tiles[roll]);
                moved = true;
                return;
            }
        }

        //and defend if able.
        if (unit.remainingActions > 0)
        {
            unit.defend.ExecuteAction(ActionCost.main);
            CombatLog.UpdateCombatLog(unit.name + " defends.");
            flagEndofTurn = true;
            return;
        }

        flagEndofTurn = true;
    }
    public void CombatShouldWorkWithTwoOpponentsAndSequentialTurns()
    {
        Globals.Config.ConcurrentTurnsEnabled = false;
        SetupScenarioForTwoZombies(out var zombie1, out var zombie2);

        // The zombies should not perform simultaneously
        GameSystems.D20.Actions.isSimultPerformer(zombie1).Should().BeFalse();
        GameSystems.D20.Actions.isSimultPerformer(zombie2).Should().BeFalse();

        // It should be zombie1's turn, run the game until it's zombie2's turn and check what zombie1 did
        GameSystems.D20.Initiative.CurrentActor.Should().Be(zombie1);
        Game.RunUntil(() => GameSystems.D20.Initiative.CurrentActor == zombie2, 10000);
        CompletedActions.Should()
        .HaveCount(1)
        .And.Contain(action => action.d20APerformer == zombie1 &&
                     action.d20ATarget == _player &&
                     action.d20ActType == D20ActionType.MOVE);
        ActionLog.Clear();

        // Now it's zombie2's turn, run until it's the player's turn and check what zombie2 did
        Game.RunUntil(() => GameSystems.D20.Initiative.CurrentActor == _player, 10000);
        CompletedActions.Should()
        .HaveCount(1)
        .And.Contain(action => action.d20APerformer == zombie2 &&
                     action.d20ATarget == _player &&
                     action.d20ActType == D20ActionType.MOVE);

        // Since both zombies just moved, there should be no combat entries
        CombatLog.Should().BeEmpty();
    }
    private void SetupScenarioForTwoZombies(out GameObject zombie1, out GameObject zombie2)
    {
        // Initially, the logs should be empty.
        CombatLog.Should().BeEmpty();
        ActionLog.Should().BeEmpty();

        zombie1 = GameSystems.MapObject.CreateObject(TestProtos.Zombie, new locXY(500, 483));
        GameSystems.Critter.GenerateHp(zombie1);
        zombie2 = GameSystems.MapObject.CreateObject(TestProtos.Zombie, new locXY(500, 484));
        GameSystems.Critter.GenerateHp(zombie2);

        // Ensure a specific turn order
        SetInitiative(_player, 20);
        SetInitiative(zombie1, 10);
        SetInitiative(zombie2, 0);

        Game.RunUntil(() => GameSystems.Combat.IsCombatActive());

        GameSystems.Combat.IsCombatActive().Should().BeTrue();
        GameSystems.D20.Initiative.CurrentActor.Should().Be(_player);
        GameSystems.D20.Initiative.Should().Equal(
            _player,
            zombie1,
            zombie2
            );

        // Without advancing time, no combat history entries should exist
        CombatLog.Should().BeEmpty();
        ActionLog.Should().BeEmpty();

        // End turn for the player
        GameSystems.Combat.AdvanceTurn(_player);

        GameSystems.Combat.IsCombatActive().Should().BeTrue();
    }
Exemple #12
0
    public static IEnumerator CheckForTurnEnd()
    {
        CombatLog.UpdateCombatLog("Action complete.");
        if (queuedActions < 1)
        {
            Debug.LogWarning("zero or less queued actions");
        }

        if (queuedActions > 1)
        {
            queuedActions--;
            yield break;
        }
        else
        {
            OnActionTaken(currentUnit);
            actionUIManager.UpdateActions(currentUnit.GetComponent <TacticsMovement>());
            queuedActions--;
            //yield return new WaitForSeconds(0.5f);

            if (currentUnit.remainingMove >= 1 || currentUnit.remainingActions > 0)
            {
                currentUnit.GetComponent <TacticsMovement>().BeginTurn();
                yield break;
            }
            if (currentUnit.focusSwitched == false)
            {
                currentUnit.canFocusSwitch = true;
                yield break;
            }
            initiativeManager.StartCoroutine(EndTurn());
            yield break;
        }
    }
Exemple #13
0
 // Start is called before the first frame update
 void Start()
 {
     CombatLog.AddMessageToQueue("The party has entered combat.");
     // Roll initiative for all the combatants at the first frame and place them in the combat queue accordingly
     combatQueue = combatQueue.OrderByDescending(combatant => combatant.Initiative).ToList();
     CombatLog.AddMessageToQueue("Initiative rolled");
     nextActiveCharacterIndex = 0;
 }
Exemple #14
0
 public virtual void ReceiveHeal(int healed)
 {
     if (!IsDead)
     {
         Stats.Heal(healed);
         CombatLog.Heal(CharacterName, healed);
     }
 }
Exemple #15
0
 public CombatUI(Character player)
 {
     Player = player;
     for (int i = 0; i < LogHeight; i++)
     {
         CombatLog.Add("");
     }
 }
Exemple #16
0
 /// <summary>
 /// Needs to be called to progress the combat queue.
 /// If the next character is dead, it proceeds to the next one without needing to be called again.
 /// </summary>
 private void NextActiveCharacter()
 {
     do
     {
         activeCharacter          = combatQueue[nextActiveCharacterIndex];
         nextActiveCharacterIndex = (nextActiveCharacterIndex + 1) % combatQueue.Count(); // Go through the list, rotating between the combatants
     } while (!activeCharacter.IsAlive);
     CombatLog.AddMessageToQueue("It's " + activeCharacter.CharacterName + "'s turn!");
 }
Exemple #17
0
 public void Cast(List <Character> Targets)
 {
     foreach (Character target in Targets)
     {
         int value = new Die(Effect.Amount).RollDie();
         target.Heal(value);
         CombatLog.AddMessageToQueue(target.CharacterName + " was healed for " + value + " hitpoints!");
     }
 }
Exemple #18
0
    /// <summary>
    /// Needs to be called when a character wants to move and returns true if able.
    /// </summary>
    /// <param name="distance">The distance in unity units(meters)</param>
    /// <returns>Returns true if the character can move or false if not.</returns>
    public bool ActiveCharacterMoves(double distance)
    {
        bool canMove = activeCharacter.Move(distance);

        if (!canMove)
        {
            CombatLog.AddMessageToQueue(activeCharacter.CharacterName + " can't move that far this round!");
        }
        return(canMove);
    }
	// Use this for initialization
	void Awake()
	{
		// If combatLog doesn't exist, this is it
		if (combatLog == null) {
			combatLog = this;
		// If combatLog exists, destory this
		} else if (combatLog != this) {
			Destroy(gameObject);
		}
	}
Exemple #20
0
 /// <summary>
 /// Needs to be called when a character wants to attack.
 /// </summary>
 /// <param name="weapon">The equipped weapon</param>
 /// <param name="target">The target of the attack</param>
 internal void ActiveCharacterAttacks(Weapon weapon, Character target, double distance)
 {
     if (weapon.Range >= HelperFunctions.MetersToFeet(distance))
     {
         activeCharacter.Attack(weapon, target);
         CheckForCombatEnd();
     }
     else
     {
         CombatLog.AddMessageToQueue("Not enough range to attack!");
     }
 }
Exemple #21
0
    //This needs sorting out.
    public IEnumerator KO()
    {
        Initiative.queuedActions++;
        CombatLog.UpdateCombatLog(name + " KOed.");
        onKO(this);

        unitAnim.SetBool("dead", true);
        yield return(new WaitForSeconds(unitAnim.GetCurrentAnimatorStateInfo(0).length + 2));

        gameObject.GetComponent <TacticsMovement>().currentTile.occupant = null;
        //Tell the initiative order to remove this unit.
        Initiative.RemoveUnit(this);
    }
Exemple #22
0
    static void StartTurn()
    {
        currentUnit = order.Peek();
        currentUnit.ResetActions();
        order.Peek().BeginTurn();
        GameObject selector = GameObject.FindGameObjectWithTag("selector");

        selector.transform.SetParent(currentUnit.transform, false);
        actionUIManager.UpdateActions(currentUnit.GetComponent <TacticsMovement>());
        CinemachineCamera.FollowUnit(currentUnit.GetComponent <TacticsMovement>());
        OnTurnStart(currentUnit);
        CombatLog.UpdateCombatLog(currentUnit.name + "(" + currentUnit.gameObject.GetInstanceID() + ")" + " starts turn.");
    }
Exemple #23
0
        public double DealDamage()
        {
            double damage = 0.0;
            Weapon w      = _weapons.GetRandomWeapon();

            if (w != null)
            {
                damage = w.Damage * GetExperticeMultiplier(w.ID);
                CombatLog.Save($"{Name} dealt {damage:F2} damage with a {w.ID} {w.Type}");
            }

            return(damage);
        }
    public override void DoTask(NPC unit, Unit targetUnit = null, Tile targetTile = null)
    {
        //Attack the target if possible.
        if (unit.remainingActions > 0)
        {
            //unit.FindAdjacentUnits();
            RangeFinder.FindAdjacentUnits(unit);
            if (target != null)
            {
                if (unit.adjacentUnits.Contains(target))
                {
                    foreach (Weapon.Target t in unit.mainWeapon.targets)
                    {
                        if (t.unitTargeted == target)
                        {
                            Initiative.queuedActions += 1;
                            unit.mainWeapon.StartCoroutine("Attack", t);
                            CombatLog.UpdateCombatLog(unit.name + " melee attacks " + target.name);
                            flagEndofTurn = true;
                            return;
                        }
                    }
                }
            }
        }

        //Dash if that's needed
        Tile tileToAttackFrom = RangeFinder.FindTileNextToTarget(unit, target.GetComponent <TacticsMovement>());

        if (tileToAttackFrom == null)
        {
            if (unit.remainingActions > 0)
            {
                unit.dash.ExecuteAction(ActionCost.main);
                CombatLog.UpdateCombatLog(unit.name + " dashes.");
                dashed = true;
            }
        }

        //Move closer to the target if needed.
        if ((unit.remainingMove > 0 && unit.remainingActions > 0) || dashed == true)
        {
            unit.destination = target.gameObject;
            CombatLog.UpdateCombatLog(unit.name + " A* toward opposing faction.");
            dashed = false;
        }
        else
        {
            flagEndofTurn = true;
        }
    }
Exemple #25
0
        private void useElderKeyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("You are about to summon an Elder God. Do you wish to continue with this decision?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                p.GodLordKeys--;
                d.isElderGod = true;

                DisableUseKeys();

                CombatLog.AppendText($"An Elder God approaches. May God have mercy on your soul.");
                CombatLog.AppendText(Environment.NewLine);
                CombatLog.AppendText(Environment.NewLine);
            }
        }
Exemple #26
0
        private void useEXBountyKeyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("You are about to summon an EX Bounty Boss. Do you wish to continue with this decision?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                p.EXBountyKeys.Remove(d.tier);
                d.isBountyBoss = true;
                d.isEXInvader  = true;
                DisableUseKeys();

                CombatLog.AppendText($"You have used an EX Bounty Key for Tier {d.tier}. The next boss you face will be an EX Bounty Boss.");
                CombatLog.AppendText(Environment.NewLine);
                CombatLog.AppendText(Environment.NewLine);
            }
        }
Exemple #27
0
        private void UseRelicButton()
        {
            if (relic != null && tp.icons > 1)
            {
                int h = r.Next(0, 100);
                if (h < 95)
                {
                    switch (relic.RelicType)
                    {
                    case 0:
                        int hp = (int)(relic.Damage * .01);

                        if ((PlayerHealth.Value + hp) >= PlayerHealth.Maximum)
                        {
                            PlayerHealth.Value = PlayerHealth.Maximum;
                        }
                        else
                        {
                            PlayerHealth.Value += hp;
                        }

                        DealDamageRelic(relic.Damage, 0);

                        break;

                    case 1:
                        int damage = relic.Damage * 2;

                        DealDamageRelic(damage, 0);

                        break;

                    default:
                        int accuracy = 100;

                        DealDamageRelic(relic.Damage, accuracy);

                        break;
                    }
                }
                else
                {
                    CombatLog.AppendText("The attack missed.");
                    CombatLog.AppendText(Environment.NewLine);
                    CombatLog.AppendText(Environment.NewLine);
                    tp.Miss();
                    CheckTurnPlayer();
                }
            }
        }
Exemple #28
0
    public override void _Ready()
    {
        if (_log == null)
        {
            _log = this;
        }
        else
        {
            QueueFree();
            return;
        }

        Output = GetNode <RichTextLabel>("Output");
    }
Exemple #29
0
        public void ReceiveDamage(double damagePoints)
        {
            if (damagePoints > 0)
            {
                _hitPoints = _hitPoints - damagePoints;
                CombatLog.Save($"{Name} receives {damagePoints:F2} damage, and is down to {_hitPoints:F2} hit points");

                if (Dead)
                {
                    CombatLog.Save("");
                    CombatLog.Save(Name + " died!");
                    CombatLog.Save("");
                }
            }
        }
Exemple #30
0
    public void Attack(Character target)
    {
        if (target.IsDead)
        {
            AttackTarget = null;
            return;
        }


        var roll   = Stats.Roll(StatType.ACCURACY);
        var damage = Stats.Damage + RegularAttack.Attack();

        CombatLog.Attack(this.CharacterName, target.CharacterName, roll);
        target.ReceiveAttack(roll, damage);
    }
Exemple #31
0
        private bool IsCritHit()
        {
            int c = r.Next(0, 100);

            if (c < 25)
            {
                CombatLog.AppendText("A critical was hit.");
                CombatLog.AppendText(Environment.NewLine);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #32
0
    // Start is called before the first frame update
    void Awake()
    {
        if (Instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }

        DontDestroyOnLoad(gameObject);

        combatLog = GetComponent <CombatLog>();
    }
Exemple #33
0
 public void OnSencePreLoadedEvent(SceneInfo _senceInfo)
 {
     GameUIManager.mInstance.HUDTextMgr.Clear();
     Globals.Instance.EffectSoundMgr.ClearCache();
     int uiLayer = LayerDefine.uiLayer;
     int uiMeshLayer = LayerDefine.uiMeshLayer;
     Camera.main.cullingMask &= ~(1 << uiLayer | 1 << uiMeshLayer);
     this.senceInfo = _senceInfo;
     this.ForceFollow = false;
     this.enableUpdate = true;
     this.preSelectScale = 1f;
     this.invoker.SetEnable(true);
     PoolMgr.spawnPool = PoolManager.Pools.Create("prefab");
     PoolMgr.spawnPoolByName = PoolManager.Pools.Create("name");
     PoolMgr.CreatePrefabPool("Skill/st_011", 5, 10);
     PoolMgr.CreatePrefabPool("Skill/st_010", 5, 10);
     PoolMgr.CreatePrefabPool("Skill/misc_001", 5, 10);
     Transform transform = PoolMgr.Spawn("Skill/misc_001");
     PoolMgr.CreateActionPrefabPool(transform);
     PoolMgr.Despawn(transform);
     PoolMgr.CreatePrefabPool("Skill/misc_002", 5, 10);
     transform = PoolMgr.Spawn("Skill/misc_002");
     PoolMgr.CreateActionPrefabPool(transform);
     PoolMgr.Despawn(transform);
     PoolMgr.CreatePrefabPool("Skill/misc_003", 1, 5);
     transform = PoolMgr.Spawn("Skill/misc_003");
     PoolMgr.CreateActionPrefabPool(transform);
     PoolMgr.Despawn(transform);
     PoolMgr.CreatePrefabPool("Skill/misc_004", 1, 5);
     transform = PoolMgr.Spawn("Skill/misc_004");
     PoolMgr.CreateActionPrefabPool(transform);
     PoolMgr.Despawn(transform);
     PoolMgr.CreatePrefabPool("Skill/Tan", 6, 6);
     transform = PoolMgr.Spawn("Skill/Tan");
     PoolMgr.CreateActionPrefabPool(transform);
     PoolMgr.Despawn(transform);
     GameObject gameObject = Res.Load<GameObject>("Skill/st_006", false);
     if (gameObject == null)
     {
         global::Debug.LogError(new object[]
         {
             "Res.Load st_006 error"
         });
     }
     else
     {
         this.selectEffect = (UnityEngine.Object.Instantiate(gameObject) as GameObject);
     }
     if (this.selectEffect == null)
     {
         global::Debug.LogError(new object[]
         {
             "Instantiate st_006 error"
         });
     }
     else
     {
         this.selectPS = this.selectEffect.GetComponentsInChildren<ParticleSystem>();
         this.selectEffect.SetActive(false);
     }
     GameUIManager.mInstance.GameStateChange(GUIGameStateTip.EGAMEING_STATE.NONE, 0);
     CameraShake.Instance.IsShaking();
     this.combatLog = new CombatLog();
     this.checkTimer = 10f;
     this.InitScene();
 }
Exemple #34
0
        //private static void round_OnRoundExecution()
        //{
        //    Round.IsRunning = true;
        //    System.Threading.Thread.Sleep(20000);
        //    Round.IsRunning = false;
        //}
        private void round_OnRoundExecution()
        {
            Round.IsRunning = true;

            Game.Log.Clear();
            World davi = World.Load(1);
            World golias = World.Load(2);

            Attackers attackers = new Attackers();
            Defenders defenders = new Defenders();

            int number = 1;
            attackers.Units = new List<Unit>();
            Unit unit = null;
            Unit baseUnit = null;
            foreach (WorldUnits worldUnit in davi.Units)
            {
                baseUnit = Unit.Find(worldUnit.UnitId);
                if (baseUnit != null)
                {
                    for (int j = 0; j < worldUnit.Quantity; j++)
                    {
                        unit = (Unit)baseUnit.Clone();
                        unit.Number = number;
                        unit.PositionInCombat = Unit.CombatPosition.attacker;
                        attackers.Units.Add(unit);
                        number += 1;
                    }
                }
            }

            number = 1;
            defenders.Units = new List<Unit>();
            unit = null;
            baseUnit = null;
            foreach (WorldUnits worldUnit in golias.Units)
            {
                baseUnit = Unit.Find(worldUnit.UnitId);
                if (baseUnit != null)
                {
                    for (int j = 0; j < worldUnit.Quantity; j++)
                    {
                        unit = (Unit)baseUnit.Clone();
                        unit.Number = number;
                        unit.PositionInCombat = Unit.CombatPosition.defender;
                        defenders.Units.Add(unit);
                        number += 1;
                    }
                }
            }

            attackers.Units = Util.ScrambleList<Unit>(attackers.Units);
            defenders.Units = Util.ScrambleList<Unit>(defenders.Units);

            Hero hero = null;
            attackers.Heroes = new List<Hero>();
            hero = Hero.Find(davi.HeroId);
            hero.SetPowers();
            attackers.Heroes.Add(hero);
            defenders.Heroes = new List<Hero>();
            hero = Hero.Find(golias.HeroId);
            hero.SetPowers();
            defenders.Heroes.Add(hero);

            int turns = attackers.Units.Count.BiggerThan(defenders.Units.Count) ? attackers.Units.Count : defenders.Units.Count;
            int rounds = 1; //round will be always one! refactor later

            HeroesPowers(turns, attackers, defenders);

            int i = 1;
            while (i <= rounds && defenders.Units.Count + defenders.Heroes.Count > 0 && attackers.Units.Count + attackers.Heroes.Count > 0)
            {
                Game.Log.Add(string.Format("<h2>Round {0}</h2><p>Atacando: {1} unidades</p><p>Defendendo: {2} unidades</p>", i, attackers.Units.Count, defenders.Units.Count));
                Game.StartCombat(turns, attackers, defenders);

                #region LOG
                Game.Log.Add(attackers.PV());
                Game.Log.Add(defenders.PV());
                RoundReport(i, attackers, defenders);
                #endregion

                //#region RESET
                //generate.RoundResetUnitLives(attackers.Units);
                //generate.RoundResetUnitLives(defenders.Units);
                //attackers.ResetHeroes();
                //defenders.ResetHeroes();
                //#endregion

                turns = attackers.Units.Count.BiggerThan(defenders.Units.Count) ? attackers.Units.Count : defenders.Units.Count;
                HeroesPowers(turns, attackers, defenders);
                i++;
            }
            Round.IsRunning = false;
            CombatLog l = new CombatLog() { Log = string.Join("<br/>", Game.Log.ToArray()), CombatId = 1 };
            l.Save();
        }
Exemple #35
0
 public void ClearActor()
 {
     GameUIManager.mInstance.HUDTextMgr.Clear();
     Globals.Instance.EffectSoundMgr.ClearCache();
     this.invoker.Clear();
     if (this.baseScene != null)
     {
         this.combatTime = this.baseScene.GetMaxCombatTimer() - this.baseScene.GetCombatTimer();
         this.baseScene.Destroy();
         this.baseScene = null;
     }
     this.senceInfo = null;
     this.actors.Clear();
     this.LopetActor = null;
     this.RemoteLopetActor = null;
     for (int i = 0; i < 5; i++)
     {
         this.actors.Add(null);
     }
     this.assistPetID = 0;
     this.assistPetAttID = 0;
     this.combatLog = null;
     this.ServerData = null;
 }
Exemple #36
0
        /// <summary>
        /// This method is call by GameTick when all creeps are dead
        /// </summary>
        public void FinishedWave()
        {
            Score += 1000;
            Score += Crystal * 1500;
            Score += Wave * 500;

            Wave++;

            State = GameState.NoAttack;

            LastCombatLog = new CombatLog(AttackInfos);
            AttackInfos.Clear();

            Projectiles.Clear();

            if (Wave == CreepWaves.Wave.Count + 1)
            {
                //Complete
                State = GameState.Complete;
            }
            else
            {
                CurrentWave = CreepWaves.Wave[Wave - 1];
            }
        }
Exemple #37
0
        public void NewGame(GameDifficulty Difficulty)
        {
            map = new Map();
            CreepPath = new MapCoordList();
            PlayerUnits = new PlayerUnitDictionary();
            AttackInfos = new AttackInfoList();
            Projectiles = new ProjectileList();

            this.Difficulty = Difficulty;

            if (Difficulty == GameDifficulty.Easy)
            {
                Gold = 250;
                Crystal = 50;
            }
            else if (Difficulty == GameDifficulty.Medium)
            {
                Gold = 150;
                Crystal = 30;
            }
            else if (Difficulty == GameDifficulty.Hard)
            {
                Gold = 75;
                Crystal = 20;
            }

            Wave = 1;
            Score = 0;
            State = GameState.NoAttack;
            LastCombatLog = new CombatLog();
            LoadMap(MapFile);
        }