Пример #1
0
        public async Task NextQuestionOnBonusZeroesBonus()
        {
            const ulong id        = 1234;
            const ulong readerId  = 12345;
            GameState   gameState = new GameState
            {
                ReaderId = readerId,
                Format   = Format.CreateTossupBonusesShootout(false)
            };

            Assert.AreEqual(PhaseStage.Tossup, gameState.CurrentStage, "Unexpected initial stage");
            Assert.IsTrue(await gameState.AddPlayer(id, "Player"), "Add should succeed.");
            gameState.ScorePlayer(10);
            Assert.AreEqual(PhaseStage.Bonus, gameState.CurrentStage, "Unexpected stage after scoring the player");

            gameState.NextQuestion();
            Assert.AreEqual(PhaseStage.Tossup, gameState.CurrentStage, "Unexpected stage after calling nextQuestion");
            IReadOnlyDictionary <string, BonusStats> bonusStats = await gameState.GetBonusStats();

            Assert.AreEqual(1, bonusStats.Count, "There should be no bonus stats");

            BonusStats stats = bonusStats.Values.First();

            Assert.AreEqual(1, stats.Heard, "Unexpected number of heard bonuses");
            Assert.AreEqual(0, stats.Total, "Unexpected number of points for the bonus");
        }
    /// <summary>
    /// Use this for initialization
    /// </summary>
    public Purchasable(int id,
                       string itemName,
                       float baseCost,
                       Sprite image,
                       float coefficent,
                       int count,
                       float resourceRate,
                       string itemID,
                       float timeToCompleteTask)
    {
        this._id              = id;
        Item_Name             = itemName;
        Base_Cost             = baseCost;
        Image                 = image;
        Coefficent            = coefficent;
        Count                 = count;
        Resource_Rate         = resourceRate;
        Item_ID               = itemID;
        Time_To_Complete_Task = timeToCompleteTask;

        Cost         = Base_Cost;
        Is_Purchased = false;

        BonusStats = new BonusStats();
    }
Пример #3
0
    private void CalculateBonusStats(Item item, BonusStats bonus)
    {
        switch (item.primaryStat)
        {
        case StatType.Health:
            bonus.bonusHP += item.primaryStatValue;
            break;

        case StatType.Magic:
            bonus.bonusMP += item.primaryStatValue;
            break;

        case StatType.Attack:
            bonus.bonusATK += item.primaryStatValue;
            break;

        case StatType.Defence:
            bonus.bonusDEF += item.primaryStatValue;
            break;

        case StatType.Agility:
            bonus.bonusAGI += item.primaryStatValue;
            break;

        case StatType.Intelligence:
            bonus.bonusINT += item.primaryStatValue;
            break;
        }

        switch (item.secondaryStat)
        {
        case StatType.Health:
            bonus.bonusHP += item.secondaryStatValue;
            break;

        case StatType.Magic:
            bonus.bonusMP += item.secondaryStatValue;
            break;

        case StatType.Attack:
            bonus.bonusATK += item.secondaryStatValue;
            break;

        case StatType.Defence:
            bonus.bonusDEF += item.secondaryStatValue;
            break;

        case StatType.Agility:
            bonus.bonusAGI += item.secondaryStatValue;
            break;

        case StatType.Intelligence:
            bonus.bonusINT += item.secondaryStatValue;
            break;
        }
    }
Пример #4
0
    public override bool InitialiseCharacter()
    {
        base.InitialiseCharacter();

        BonusStats bonus = new BonusStats();

        CalculateBonusStats(weapon, bonus);
        CalculateBonusStats(armour, bonus);

        maxHP      = baseHP + (hpPerLevel * (level - 1)) + bonus.bonusHP;
        maxMP      = baseMP + (mpPerLevel * (level - 1)) + bonus.bonusMP;
        currentATK = baseATK + (atkPerLevel * (level - 1)) + bonus.bonusATK;
        currentDEF = baseDEF + (defPerLevel * (level - 1)) + bonus.bonusDEF;
        currentAGI = baseAGI + (agiPerLevel * (level - 1)) + bonus.bonusAGI;
        currentINT = baseINT + (intPerLevel * (level - 1)) + bonus.bonusINT;

        return(true);
    }
Пример #5
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    public Item(string name,
                int id,
                int imageID,
                bool stackable,
                ItemRarity itemRarity,
                SlotType slotType,
                ResourceType resourceType)
    {
        Name         = name;
        ID           = id;
        ImageID      = imageID;
        Stackable    = stackable;
        ItemRarity   = itemRarity;
        SlotType     = slotType;
        ResourceType = resourceType;

        BonusStats    = new BonusStats();
        BonusAttached = new List <Tuple <BonusType, float> >();
        AddBonus(BonusType, B_Amount);
    }
Пример #6
0
    public BonusStats GetStatData()
    {
        BonusStats result = new BonusStats();

        result.bonusHP  = baseHP + (hpPerLevel * (level - 1));
        result.bonusMP  = baseMP + (mpPerLevel * (level - 1));
        result.bonusATK = baseATK + (atkPerLevel * (level - 1));
        result.bonusDEF = baseDEF + (defPerLevel * (level - 1));
        result.bonusAGI = baseAGI + (agiPerLevel * (level - 1));
        result.bonusINT = baseINT + (intPerLevel * (level - 1));

        if (weapon.appraised)
        {
            CalculateBonusStats(weapon, result);
        }
        if (armour.appraised)
        {
            CalculateBonusStats(armour, result);
        }

        return(result);
    }
Пример #7
0
 public void RemoveBonusStats(BonusStats bonusStats)
 {
     this.BaseAdditives.Remove(bonusStats);
 }
Пример #8
0
 public void AddBonusStats(BonusStats bonusStats)
 {
     this.BaseAdditives.Add(bonusStats);
 }
Пример #9
0
 /// <summary>
 /// Use this for initialization
 /// </summary>
 public Item()
 {
     ID         = 000;
     BonusStats = new BonusStats();
 }
 public void RemoveBonus()
 {
     BonusStats = new BonusStats();
 }