Example #1
0
 private void swapOrder()
 {
     // Swaps order of weapons
     // SpellSlots pos1 = spellSlots.removeAt(0);
     // spellSlots.Add(pos1);
     if (activatedSpells.Count == 3)
     {
         SpellSlots pos1 = activatedSpells[0];
         SpellSlots pos2 = activatedSpells[1];
         SpellSlots pos3 = activatedSpells[2];
         activatedSpells = new List <SpellSlots>();
         activatedSpells.Add(pos2);
         activatedSpells.Add(pos3);
         activatedSpells.Add(pos1);
         showSpells();
     }
     if (activatedSpells.Count == 2)
     {
         SpellSlots pos1 = activatedSpells[0];
         SpellSlots pos2 = activatedSpells[1];
         activatedSpells = new List <SpellSlots>();
         activatedSpells.Add(pos2);
         activatedSpells.Add(pos1);
         showSpells();
     }
 }
Example #2
0
 public void SetSelectedSpellID(SpellSlots slot, int spellID)
 {
     if (availableSpells.Contains(spellID))
     {
         selectedSpells[(int)slot] = spellID;
     }
 }
Example #3
0
        public SpellInSlot[] GetSpellsSlots(int spellLevel, Guid classId)
        {
            var nrOfSlots = GetNumberOfSpellSlotsForClass(spellLevel, classId);
            var slotsList = new SpellInSlot[nrOfSlots];

            if (SpellSlots == null)
            {
                return(slotsList);
            }
            var spellSlotsForClass   = SpellSlots.Where(x => x.SpellChosenForClass.ID == classId).ToList();
            var spellForCurrentLevel = spellSlotsForClass.Where(x => x.Spell.CasterRequirements.Any(y => y.CasterClass.ID == classId && y.CasterLevel == spellLevel)).ToList();

            for (int i = 0; i < spellForCurrentLevel.Count; ++i)
            {
                slotsList[i] = new SpellInSlot
                {
                    Components       = spellForCurrentLevel[i].Spell.GetComponentsString(),
                    Duration         = "TODO",
                    Id               = spellForCurrentLevel[i].ID,
                    Name             = spellForCurrentLevel[i].Spell.Name,
                    Range            = spellForCurrentLevel[i].Spell.GetRangeString(),
                    SR               = spellForCurrentLevel[i].Spell.GetSpellResistanceString(),
                    Save             = spellForCurrentLevel[i].Spell.GetSave(),
                    School           = spellForCurrentLevel[i].Spell.School.Name,
                    TargetEffectArea = spellForCurrentLevel[i].Spell.GetTarget(),
                    Time             = spellForCurrentLevel[i].Spell.CastingTime.ToString(),
                    SlotSpend        = spellForCurrentLevel[i].Used,
                    CurrentlyUsable  = !spellForCurrentLevel[i].Used && spellForCurrentLevel[i].IsUsableInCurrentRound(Round.GetPossibleActions(_bonusDto))
                };
            }
            return(slotsList);
        }
Example #4
0
 public bool IsSpellAvailable(SpellSlots slot)
 {
     if (spellCooldowns[(int)slot] == 0)
     {
         // TODO: Player stunned or otherwise unable to cast...?
         return(true);
     }
     return(false);
 }
Example #5
0
 public void UpdateSlots()
 {
     Selected = null;
     SpellSlots.ReplaceRange(from s in Model.Context.Player.GetSpellSlotInfo(SpellcastingID) select new SpellSlotViewModel(s)
     {
         Reset  = OnReset,
         Reduce = OnReduce
     }
                             .UpdateUsed());
 }
 public Character5E(bool createDefaultData = false)
 {
     if (createDefaultData)
     {
         AbilityScores = new Dictionary <MainStatType, int>
         {
             { MainStatType.Strength, 10 },
             { MainStatType.Dexterity, 10 },
             { MainStatType.Constitution, 10 },
             { MainStatType.Intelligence, 10 },
             { MainStatType.Wisdom, 10 },
             { MainStatType.Charisma, 10 },
         };
         AbilityScoreProficiencies = new Dictionary <MainStatType, bool>
         {
             { MainStatType.Strength, false },
             { MainStatType.Dexterity, false },
             { MainStatType.Constitution, false },
             { MainStatType.Intelligence, false },
             { MainStatType.Wisdom, false },
             { MainStatType.Charisma, false },
         };
         CalculateAbilityModifiers();
         Skills = new List <Skill>
         {
             new Skill("Acrobatics", AbilityModifiers[MainStatType.Dexterity], ProficiencyBonus, MainStatType.Dexterity, false),
             new Skill("Animal Handling", AbilityModifiers[MainStatType.Wisdom], ProficiencyBonus, MainStatType.Wisdom, false),
             new Skill("Arcana", AbilityModifiers[MainStatType.Intelligence], ProficiencyBonus, MainStatType.Intelligence, false),
             new Skill("Athletics", AbilityModifiers[MainStatType.Strength], ProficiencyBonus, MainStatType.Strength, false),
             new Skill("Deception", AbilityModifiers[MainStatType.Charisma], ProficiencyBonus, MainStatType.Charisma, false),
             new Skill("History", AbilityModifiers[MainStatType.Intelligence], ProficiencyBonus, MainStatType.Intelligence,
                       false),
             new Skill("Insight", AbilityModifiers[MainStatType.Wisdom], ProficiencyBonus, MainStatType.Wisdom, false),
             new Skill("Intimidation", AbilityModifiers[MainStatType.Charisma], ProficiencyBonus, MainStatType.Charisma, false),
             new Skill("Investigation", AbilityModifiers[MainStatType.Intelligence], ProficiencyBonus, MainStatType.Intelligence,
                       false),
             new Skill("Medicine", AbilityModifiers[MainStatType.Wisdom], ProficiencyBonus, MainStatType.Wisdom, false),
             new Skill("Nature", AbilityModifiers[MainStatType.Intelligence], ProficiencyBonus, MainStatType.Intelligence, false),
             new Skill("Perception", AbilityModifiers[MainStatType.Wisdom], ProficiencyBonus, MainStatType.Wisdom, false),
             new Skill("Performance", AbilityModifiers[MainStatType.Charisma], ProficiencyBonus, MainStatType.Charisma, false),
             new Skill("Persuasion", AbilityModifiers[MainStatType.Charisma], ProficiencyBonus, MainStatType.Charisma, false),
             new Skill("Religion", AbilityModifiers[MainStatType.Intelligence], ProficiencyBonus, MainStatType.Intelligence,
                       false),
             new Skill("Sleight of Hand", AbilityModifiers[MainStatType.Dexterity], ProficiencyBonus, MainStatType.Dexterity,
                       false),
             new Skill("Stealth", AbilityModifiers[MainStatType.Dexterity], ProficiencyBonus, MainStatType.Dexterity, false),
             new Skill("Survival", AbilityModifiers[MainStatType.Wisdom], ProficiencyBonus, MainStatType.Wisdom, false),
         };
         CalculateSkillBonuses();
         for (int i = 0; i < 9; i++)
         {
             SpellSlots.Add(new Pair <int, int>(0, 0));
         }
     }
 }
Example #7
0
    private void Start()
    {
        spellSlots = new SpellSlots();
        spellSlots.fillAllSlots();
        currentHealth = maxHealth;

        if (this.gameObject.tag == "Player")
        {
            GameObject g = Instantiate(healthbar_prefab, GameObject.FindGameObjectWithTag("Health Parent").transform);
            healthText      = g.GetComponent <Text>();
            healthText.text = currentHealth.ToString();
        }

        Debug.Log(File.Exists(Application.dataPath + "/scripts/combat/spells.json"));
        loadSpells();
    }
Example #8
0
        } = true;                                                         //The value of this should be pulled from the spellcasting class

        //Public Methods
        public static void AddSpellcasterLevel(SpellcasterClass spellcaster)
        {
            switch (spellcaster)
            {
            case SpellcasterClass.PRIMARY:
                _spellcasterLevel++;
                break;

            case SpellcasterClass.SECONDARY:
                _spellcasterLevel += 0.5;
                break;

            case SpellcasterClass.TERTIARY:
                _spellcasterLevel += (1.0 / 3.0);
                break;

            case SpellcasterClass.NONE:
                break;
            }

            switch (SpellcasterLevel)
            {
            case 1:
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 1, TotalSlots = 2
                });
                break;

            case 2:
                SpellSlots.Where(l => l.SpellLevel == 1).FirstOrDefault().TotalSlots++;
                break;

            case 3:
                SpellSlots.Where(l => l.SpellLevel == 1).FirstOrDefault().TotalSlots++;
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 2, TotalSlots = 2
                });
                break;

            case 4:
                SpellSlots.Where(l => l.SpellLevel == 2).FirstOrDefault().TotalSlots++;
                break;

            case 5:
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 3, TotalSlots = 2
                });
                break;

            case 6:
                SpellSlots.Where(l => l.SpellLevel == 3).FirstOrDefault().TotalSlots++;
                break;

            case 7:
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 4, TotalSlots = 1
                });
                break;

            case 8:
                SpellSlots.Where(l => l.SpellLevel == 4).FirstOrDefault().TotalSlots++;
                break;

            case 9:
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 5, TotalSlots = 1
                });
                break;

            case 10:
                SpellSlots.Where(l => l.SpellLevel == 5).FirstOrDefault().TotalSlots++;
                break;

            case 11:
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 6, TotalSlots = 1
                });
                break;

            case 13:
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 7, TotalSlots = 1
                });
                break;

            case 15:
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 8, TotalSlots = 1
                });
                break;

            case 17:
                SpellSlots.Add(new SpellSlot()
                {
                    SpellLevel = 9, TotalSlots = 1
                });
                break;

            case 18:
                SpellSlots.Where(l => l.SpellLevel == 5).FirstOrDefault().TotalSlots++;
                break;

            case 19:
                SpellSlots.Where(l => l.SpellLevel == 6).FirstOrDefault().TotalSlots++;
                break;

            case 20:
                SpellSlots.Where(l => l.SpellLevel == 7).FirstOrDefault().TotalSlots++;
                break;

            default:
                break;
            }
        }
Example #9
0
 public void PutSpellOnCD(SpellSlots slot)
 {
     spellCooldowns[(int)slot] = SpellDatabase.GetSpellData(selectedSpells[(int)slot]).cooldown;
 }
Example #10
0
 public Spell GetSelectedSpell(SpellSlots slot)
 {
     return(SpellDatabase.GetSpellData(selectedSpells[(int)slot]));
 }
Example #11
0
 public int GetSelectedSpellID(SpellSlots slot)
 {
     return(selectedSpells[(int)slot]);
 }