コード例 #1
0
        public static void CastArcaneIntellect(Player player, int index)
        {
            player.ManaPoints -= player.Spellbook[index].ManaCost;

            const string intellectString = "You cast Arcane Intellect on yourself.";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                intellectString);

            int arcaneIntIndex = player.Effects.FindIndex(e => e.Name == player.Spellbook[index].Name);

            if (arcaneIntIndex != -1)
            {
                player.Effects[arcaneIntIndex].IsEffectExpired = true;
            }

            player.Intelligence += player.Spellbook[index].ChangeAmount.Amount;

            PlayerHelper.CalculatePlayerStats(player);

            player.Effects.Add(
                new ChangeStatEffect(player.Spellbook[index].Name, player.Spellbook[index].ChangeAmount.ChangeMaxRound,
                                     StatType.Intelligence, player.Spellbook[index].ChangeAmount.Amount));
        }
コード例 #2
0
        private Player AugmentPlayerStat(Player player)
        {
            // Set effectStatCategory to Constitution by default so it is initialized
            StatType effectStatCategory = StatType.Constitution;

            switch (StatPotionType)
            {
            case StatType.Constitution:
                player.Constitution += StatAmount;
                break;

            case StatType.Dexterity:
                player.Dexterity  += StatAmount;
                effectStatCategory = StatType.Dexterity;
                break;

            case StatType.Intelligence:
                player.Intelligence += StatAmount;
                effectStatCategory   = StatType.Intelligence;
                break;

            case StatType.Strength:
                player.Strength   += StatAmount;
                effectStatCategory = StatType.Strength;
                break;
            }

            PlayerHelper.CalculatePlayerStats(player);

            string effectName = $"{StatPotionType} (+{StatAmount})";

            player.Effects.Add(new ChangeStatEffect(effectName, _statEffectDurationInSeconds, effectStatCategory, StatAmount));

            return(player);
        }
コード例 #3
0
        public static void UseSwiftAura(Player player, int index)
        {
            DeductAbilityCost(player, index);

            const string swiftAuraString = "You generate a Swift Aura around yourself.";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                swiftAuraString);

            int swiftAuraIndex = player.Effects.FindIndex(e => e.Name == player.Abilities[index].Name);

            if (swiftAuraIndex != -1)
            {
                player.Effects[swiftAuraIndex].IsEffectExpired = true;
            }

            player.Dexterity += player.Abilities[index].ChangeAmount.Amount;

            PlayerHelper.CalculatePlayerStats(player);

            player.Effects.Add(new ChangeStatEffect(player.Abilities[index].Name, player.Abilities[index].ChangeAmount.ChangeMaxRound,
                                                    StatType.Dexterity, player.Abilities[index].ChangeAmount.Amount));
        }
コード例 #4
0
        private void RestorePlayerStatToNormal(Player player)
        {
            if (EffectStatType is StatType.Intelligence)
            {
                player.Intelligence -= _statAmount;
            }
            else if (EffectStatType is StatType.Strength)
            {
                player.Strength -= _statAmount;
            }
            else if (EffectStatType is StatType.Dexterity)
            {
                player.Dexterity -= _statAmount;
            }
            else if (EffectStatType is StatType.Constitution)
            {
                player.Constitution -= _statAmount;
            }

            PlayerHelper.CalculatePlayerStats(player);
        }