private static void Validate(
     CombatStatistics statistics,
     int?range = null,
     IDamageTypesStore attackDetails  = null,
     IDamageTypesStore defenseDetails = null)
 {
     Assert.AreEqual(range ?? Range, statistics.Range);
     Assert.AreSame(attackDetails ?? AttackDetails, statistics.AttackDetails);
     Assert.AreSame(defenseDetails ?? DefenseDetails, statistics.DefenseDetails);
 }
Example #2
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Example #3
0
    private void Start()
    {
        healthBar.SetActive(true);

        //Initialize variables
        meshRender       = GetComponent <MeshRenderer>();
        combatStatistics = CombatStatistics.instance;
        equipmentHolder  = EquipmentHolder.instance;
        dataRetainer     = DataRetainer.instance;

        if (gameObject.tag == "Player")
        {
            playerLevel = dataRetainer.GetPlayerLevel(playerIndex);
        }

        maxHealth    = baseStatus.health + (int)(((playerLevel / 10.0) + baseStatus.health / 8.0) * playerLevel);
        health       = maxHealth;
        defense      = baseStatus.defense + (int)((baseStatus.defense / 4.0) * playerLevel);
        speed        = baseStatus.speed + (int)((baseStatus.speed / 4.0) * playerLevel);
        strength     = baseStatus.strength + (int)((baseStatus.strength / 4.0) * playerLevel);
        dexterity    = baseStatus.dexterity + (int)((baseStatus.dexterity / 4.0) * playerLevel);
        intelligence = baseStatus.intelligence + (int)((baseStatus.intelligence / 4.0) * playerLevel);
        maxMP        = 2 * intelligence;
        currentMp    = maxMP;

        //Calculate all status variables
        if (gameObject.tag == "Player")
        {
            //If it is a player we add the base status + the equipment status
            health    = dataRetainer.GetPlayerHealth(playerIndex);
            currentMp = dataRetainer.GetPlayerMP(playerIndex);

            maxHealth    += equipmentHolder.playersHealth[playerIndex];
            speed        += equipmentHolder.playersSpeed[playerIndex];
            defense      += equipmentHolder.playersDefense[playerIndex];
            strength     += equipmentHolder.playersStrength[playerIndex];
            dexterity    += equipmentHolder.playersDexterity[playerIndex];
            intelligence += equipmentHolder.playersIntelligence[playerIndex];

            xpNeeded  = baseStatus.xp + (4 * (playerLevel ^ 3)) / 7;
            currentXP = dataRetainer.GetPlayerXP(playerIndex);
        }

        //Set the UI
        damageText.text          = "";
        healthBarFill.fillAmount = (float)health / maxHealth;
        healthText.text          = "" + health + "/" + maxHealth;
        mpBar.fillAmount         = (float)currentMp / maxMP;
        mpText.text = "" + currentMp + "/" + maxMP;

        enemyCombatAI = EnemyCombatAI.instance;
    }
Example #4
0
        public void WithCombatStatistics()
        {
            var attack = ImmutableDictionary <DamageTypes, int>
                         .Empty
                         .SetItem(DamageTypes.Acid, 1);

            var defense = ImmutableDictionary <DamageTypes, int>
                          .Empty
                          .SetItem(DamageTypes.BluntImpact, 1);

            var statistics = CombatStatistics
                             .Create(1, attack, defense)
                             .ToSome();

            Validate(
                Thing.With(combatStatistics: statistics),
                combatStatistics: statistics);
        }
Example #5
0
    private void Start()
    {
        // Initialize variables
        dataRetainer     = DataRetainer.instance;
        combatManager    = CombatScript.instance;
        combatStatistics = CombatStatistics.instance;
        enemyAI          = GetComponent <EnemyCombatAI>();

        characters   = FindObjectsOfType <Status>();
        turnWaitTime = new int[characters.Length];

        // Assign the default value to all locations in turnLayout
        for (int index = 0; index < turnLayout.Length; index++)
        {
            turnLayout[index] = -1;
        }

        DefaultInit();                              //Initialize the default turn layout
        StartCoroutine(ChangeTurnsWaitTime(0.5f));  //Start changing turns with delay
    }
Example #6
0
 public Entity()
 {
     CombatStats    = new CombatStatistics();
     ClientStatuses = new ConcurrentDictionary <Enum.ClientStatus, Structures.ClientStatus>();
     ClientEffects  = new ConcurrentDictionary <ClientEffect, long>();
 }