import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root',
})
export class ClassService {
  constructor() {}

  // FUNCTIONS

  public getClassDetails(className: string): any {
    switch (className) {
      case 'Fighter':
        return this.fighter;
      case 'Barbarian':
        return this.barbarian;
      case 'Cleric':
        return this.cleric;
      default:
        return this.notImplementedYet;
    }
  }

  // CLASS DETAILS

  public fighter: any = {
    title: 'Kämpfer',
    description: `
    Fighters share an unparalleled mastery with weapons and armor, and a thorough knowledge of the skills of combat. They are well acquainted with death, both meting it out and staring it defiantly in the face.


    ### Class Features

    As a fighter, you gain the following class features.

    #### Hit Points

    **Hit Dice:** 1d10 per fighter level
    
    **Hit Points at 1st Level:** 10 + your Constitution modifier
    
    **Hit Points at Higher Levels:** 1d10 (or 6) + your Constitution modifier per fighter level after 1st

    #### Proficiencies
    **Armor:** All armor, shields

    **Weapons:** Simple weapons, martial weapons

    **Tools:** None

    **Saving Throws:** Strength, Constitution

    **Skills:** Choose two skills from Acrobatics, Animal Handling, Athletics, History, Insight, Intimidation, Perception, and Survival

    #### Equipment
    - (a) chain mail or (b) leather, longbow, and 20 arrows
    - (a) a martial weapon and a shield or (b) two martial weapons
    - (a) a light crossbow and 20 bolts or (b) two handaxes
    - (a) a dungeoneer's pack or (b) an explorer's pack
    `,
    features: [
      {
        name: 'Fighting Style',
        level: 1,
        description: `

      You adopt a particular style of fighting as your specialty. Choose one of the following options. You can't take a Fighting Style option more than once, even if you later get to choose again.

      - Archery (PHB). You gain a +2 bonus to attack rolls you make with ranged weapons.
      - Blind Fighting (TCE). You have blindsight with a range of 10 feet. Within that range, you can effectively see anything that isn't behind total cover, even if you're blinded or in darkness. Moreover, you can see an invisible creature within that range, unless the creature successfully hides from you.
      - Defense (PHB). While you are wearing armor, you gain a +1 bonus to AC.
      - Dueling (PHB). When you are wielding a melee weapon in one hand and no other weapons, you gain a +2 bonus to damage rolls with that weapon.
      - Great Weapon Fighting (PHB). When you roll a 1 or 2 on a damage die for an attack you make with a melee weapon that you are wielding with two hands, you can reroll the die and must use the new roll, even if the new roll is a 1 or a 2. The weapon must have the two-handed or versatile property for you to gain this benefit.
      - Interception (TCE). When a creature you can see hits a target, other than you, within 5 feet of you with an attack, you can use your reaction to reduce the damage the target takes by 1d10 + your proficiency bonus (to a minimum of 0 damage). You must be wielding a shield or a simple or martial weapon to use this reaction.
      - Protection (PHB). When a creature you can see attacks a target other than you that is within 5 feet of you, you can use your reaction to impose disadvantage on the attack roll. You must be wielding a shield.
      - Superior Technique (TCE). You learn one maneuver of your choice from among those available to the Battle Master archetype. If a maneuver you use requires your target to make a saving throw to resist the maneuver's effects, the saving throw DC equals 8 + your proficiency bonus + your Strength or Dexterity modifier (your choice.)
      - You gain one superiority die, which is a d6 (this die is added to any superiority dice you have from another source). This die is used to fuel your maneuvers. A superiority die is expended when you use it. You regain your expended superiority dice when you finish a short or long rest.
      - Thrown Weapon Fighting (TCE). You can draw a weapon that has the thrown property as part of the attack you make with the weapon.
      - In addition, when you hit with a ranged attack using a thrown weapon, you gain a +2 bonus to the damage roll.
      - Two-Weapon Fighting (PHB). When you engage in two-weapon fighting, you can add your ability modifier to the damage of the second attack.
      - Unarmed Fighting (TCE). Your unarmed strikes can deal bludgeoning damage equal to 1d6 + your Strength modifier on a hit. If you aren't wielding any weapons or a shield when you make the attack roll, the d6 becomes a d8.
      - At the start of each of your turns, you can deal 1d4 bludgeoning damage to one creature grappled by you.
      - Close Quarters Shooter (UA). When making a ranged attack while you are within 5 feet of a hostile creature, you do not have disadvantage on the attack roll. Your ranged attacks ignore half cover and three-quarters cover against targets within 30 feet of you. You have a +1 bonus to attack rolls on ranged attacks.
      - Mariner (UA). As long as you are not wearing heavy armor or using a shield, you have a swimming speed and a climbing speed equal to your normal speed, and you gain a +1 bonus to armor class.
      - Tunnel Fighter (UA). As a bonus action, you can enter a defensive stance that lasts until the start of your next turn. While in your defensive stance, you can make opportunity attacks without using your reaction, and you can use your reaction to make a melee attack against a creature that moves more than 5 feet while within your reach.
      
      `,
      },
      {
        name: 'Second Wind',
        level: 1,
        description: `
          You have a limited well of stamina that you can draw on to protect yourself from harm. On your turn, you can use a bonus action to regain hit points equal to 1d10 + your fighter level.

          Once you use this feature, you must finish a short or long rest before you can use it again.
      
        `,
      },
      {
        name: 'Action Surge',
        level: 2,
        description: `
          Starting at 2nd level, you can push yourself beyond your normal limits for a moment. On your turn, you can take one additional action.

          Once you use this feature, you must finish a short or long rest before you can use it again. Starting at 17th level, you can use it twice before a rest, but only once on the same turn.
      
        `,
      },
      {
        name: 'Martial Archetype',
        level: 3,
        description: `
          At 3rd level, you choose an archetype that you strive to emulate in your combat styles and techniques. The archetype you choose grants you features at 3rd level and again at 7th, 10th, 15th, and 18th level.    
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 4,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Extra Attack',
        level: 5,
        description: `
          Beginning at 5th level, you can attack twice, instead of once, whenever you take the Attack action on your turn.

          The number of attacks increases to three when you reach 11th level in this class and to four when you reach 20th level in this class.    
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 6,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 8,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Indomitable',
        level: 9,
        description: `
          Beginning at 9th level, you can reroll a saving throw that you fail. If you do so, you must use the new roll, and you can't use this feature again until you finish a long rest.  
        `,
      },
      {
        name: 'Extra Attack (x3)',
        level: 11,
        description: `
          You can now attack thrice whenever you take the Attack action on your turn.   
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 12,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Indomitable (x2)',
        level: 13,
        description: `
          You can reroll a saving throw that you fail. If you do so, you must use the new roll, and you can't use this feature again until you finish a long rest. You can now use this feature twice between long rests.  
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 14,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 16,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Indomitable (x3)',
        level: 17,
        description: `
          You can reroll a saving throw that you fail. If you do so, you must use the new roll, and you can't use this feature again until you finish a long rest. You can now use this feature thrice between long rests.  
        `,
      },
      {
        name: 'Action Surge (x2)',
        level: 17,
        description: `
          Starting at 17th level, you can use it twice before a rest, but only once on the same turn.
      
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 19,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Extra Attack (x4)',
        level: 20,
        description: `
          You can now attack four times whenever you take the Attack action on your turn. 
        `,
      },
    ],
  };

  public barbarian: any = {
    title: 'Barbar',
    description: `
    Barbarians are savage warriors who deal with their opponents through a combination of sheer brute force and terrifying rage. Their strength and ferocity make them well suited for melee combat. Barbarians are also able to wreak havoc on their enemies using unorthodox methods, such as throwing improvised weapons or even their own bodies.

    ### Class Features

    As a barbarian, you gain the following class features.

    #### Hit Points

    **Hit Dice:** 1d12 per barbarian level
    
    **Hit Points at 1st Level:** 12 + your Constitution modifier
    
    **Hit Points at Higher Levels:** 1d12 (or 7) + your Constitution modifier per barbarian level after 1st

    #### Proficiencies
    **Armor:** Light armor, medium armor, shields

    **Weapons:** Simple weapons, martial weapons

    **Tools:** None

    **Saving Throws:** Strength, Constitution

    **Skills:** Choose two skills from Animal Handling, Athletics, Intimidation, Nature, Perception, and Survival

    #### Equipment
    - (a) a greataxe or (b) any martial melee weapon
    - (a) two handaxes or (b) any simple weapon
    - An explorer's pack and four javelins
    `,
    features: [
      {
        name: 'Rage',
        level: 1,
        description: `
          In battle, you fight with primal ferocity. On your turn, you can enter a rage as a bonus action.

          While raging, you gain the following benefits if you aren't wearing heavy armor:

          - You have advantage on Strength checks and Strength saving throws.
          - When you make a melee weapon attack using Strength, you gain a bonus to the damage roll that increases as you gain levels as a barbarian, as shown in the Rage Damage column of the Barbarian table.
          - You have resistance to bludgeoning, piercing, and slashing damage.
          - If you are able to cast spells, you can't cast them or concentrate on them while raging.
          - Your rage lasts for 1 minute. It ends early if you are knocked unconscious or if your turn ends and you haven't attacked a hostile creature since your last turn or taken damage since then. You can also end your rage on your turn as a bonus action.
          - Once you have raged the number of times shown for your barbarian level in the Rages column of the Barbarian table, you must finish a long rest before you can rage again.
        `,
      },
      {
        name: 'Unarmored Defense',
        level: 1,
        description: `
          While you are not wearing any armor, your Armor Class equals 10 + your Dexterity modifier + your Constitution modifier. You can use a shield and still gain this benefit.
        `,
      },
      {
        name: 'Reckless Attack',
        level: 2,
        description: `
          Starting at 2nd level, you can throw aside all concern for defense to attack with fierce desperation. When you make your first attack on your turn, you can decide to attack recklessly. Doing so gives you advantage on melee weapon attack rolls using Strength during this turn, but attack rolls against you have advantage until your next turn.
        `,
      },
      {
        name: 'Danger Sense',
        level: 2,
        description: `
          At 2nd level, you gain an uncanny sense of when things nearby aren't as they should be, giving you an edge when you dodge away from danger.

          You have advantage on Dexterity saving throws against effects that you can see, such as traps and spells. To gain this benefit, you can't be blinded, deafened, or incapacitated.
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 4,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Extra Attack',
        level: 5,
        description: `
          Beginning at 5th level, you can attack twice, instead of once, whenever you take the Attack action on your turn.

          The number of attacks increases to three when you reach 11th level in this class and to four when you reach 20th level in this class.    
        `,
      },
      {
        name: 'Fast Movement',
        level: 5,
        description: `
          Starting at 5th level, your speed increases by 10 feet while you aren't wearing heavy armor.
        `,
      },
      {
        name: 'Feral Instinct',
        level: 7,
        description: `
          By 7th level, your instincts are so honed that you have advantage on initiative rolls.

          Additionally, if you are surprised at the beginning of combat and aren't incapacitated, you can act normally on your first turn, but only if you enter your rage before doing anything else on that turn.
        `,
      },
      {
        name: 'Brutal Critical',
        level: 9,
        description: `
          Beginning at 9th level, you can roll one additional weapon damage die when determining the extra damage for a critical hit with a melee attack.

          This increases to two additional dice at 13th level and three additional dice at 17th level.
        `,
      },
      {
        name: 'Relentless Rage',
        level: 11,
        description: `
          Starting at 11th level, your rage can keep you fighting despite grievous wounds. If you drop to 0 hit points while you're raging and don't die outright, you can make a DC 10 Constitution saving throw. If you succeed, you drop to 1 hit point instead.

          Each time you use this feature after the first, the DC increases by 5. When you finish a short or long rest, the DC resets to 10.
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 12,
        description: `
          When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
        `,
      },
      {
        name: 'Persistent Rage',
        level: 15,
        description: `
          Beginning at 15th level, your rage is so fierce that it ends early only if you fall unconscious or if you choose to end it.
        `,
      },
      {
        name: 'Indomitable Might',
        level: 18,
        description: `
          Beginning at 18th level, if your total for a Strength check is less than your Strength score, you can use that score in place of the total.

          ### Primal Champion

          At 20th level, you embody the power of the wilds. Your Strength and Constitution scores increase by 4. Your maximum for those scores is now 24.
        `,
      },
    ],
  };

  public cleric: any = {
    title: 'Cleric',
    description: `
    Clerics are intermediaries between the mortal world and the distant planes of the gods. As varied as the gods they serve, clerics strive to embody the handiwork of their deities. No ordinary priest, a cleric is imbued with divine magic.

    ### Class Features

    As a cleric, you gain the following class features.

    #### Hit Points

    **Hit Dice:** 1d8 per cleric level
    
    **Hit Points at 1st Level:** 8 + your Constitution modifier
    
    **Hit Points at Higher Levels:** 1d8 (or 5) + your Constitution modifier per cleric level after 1st

    #### Proficiencies
    **Armor:** Light armor, medium armor, shields

    **Weapons:** Simple weapons

    **Tools:** None

    **Saving Throws:** Wisdom, Charisma

    **Skills:** Choose two from History, Insight, Medicine, Persuasion, and Religion

    #### Equipment
    - (a) a mace or (b) a warhammer (if proficient)
    - (a) scale mail, (b) leather armor, or (c) chain mail (if proficient)
    - (a) a light crossbow and 20 bolts or (b) any simple weapon
    - (a) a priest's pack or (b) an explorer's pack
    - A shield and a holy symbol

    ### Spellcasting

    As a conduit for divine power, you can cast cleric spells.

    #### Cantrips

    At 1st level, you know three cantrips of your choice from the cleric spell list. You learn additional cleric cantrips of your choice at higher levels, as shown in the Cantrips Known column of the Cleric table.

    #### Spell Slots

    The Cleric table shows how many spell slots you have to cast your cleric spells of 1st level and higher. To cast one of these spells, you must expend a slot of the spell's level or higher. You regain all expended spell slots when you finish a long rest.

    You prepare the list of cleric spells that are available for you to cast, choosing from the cleric spell list. When you do so, choose a number of cleric spells equal to your Wisdom modifier + your cleric level (minimum of one spell). The spells must be of a level for which you have spell slots.

    For example, if you are a 3rd-level cleric, you have four 1st-level and two 2nd-level spell slots. With a Wisdom of 16, your list of prepared spells can include six spells of 1st or 2nd level, in any combination. If you prepare the 1st-level spell Cure Wounds, you can cast it using a 1st-level or 2nd-level slot. Casting the spell doesn't remove it from your list of prepared spells.

    You can change your list of prepared spells when you finish a long rest. Preparing a new list of cleric spells requires time spent in prayer and meditation: at least 1 minute per spell level for each spell on your list.

    #### Spellcasting Ability

    Wisdom is your spellcasting ability for your cleric spells. The power of your spells comes from your devotion to your deity. You use your Wisdom whenever a cleric spell refers to your spellcasting ability. In addition, you use your Wisdom modifier when setting the saving throw DC for a cleric spell you cast and when making an attack roll with one.

    **Spell save DC:** 8 + your proficiency bonus + your Wisdom modifier

    **Spell attack modifier:** your proficiency bonus + your Wisdom modifier

    `,
    features: [
      {
        name: 'Divine Domain',
        level: 1,
        description: `
          At 1st level, you choose a domain shaped by your choice of Deity and the gifts they grant you. Your choice grants you domain spells and other features when you choose it at 1st level. It also grants you additional ways to use Channel Divinity when you gain that feature at 2nd level, and additional benefits at 6th, 8th, and 17th levels.
          `,
      },
      {
        name: 'Channel Divinity',
        level: 2,
        description: `
          At 2nd level, you gain the ability to channel divine energy directly from your deity, using that energy to fuel magical effects. You start with two such effects: Turn Undead and an effect determined by your domain. Some domains grant you additional effects as you advance in levels, as noted in the domain description.

          When you use your Channel Divinity, you choose which effect to create. You must then finish a short or long rest to use your Channel Divinity again.

          Some Channel Divinity effects require saving throws. When you use such an effect from this class, the DC equals your cleric spell save DC.

          Beginning at 6th level, you can use your Channel Divinity twice between rests, and beginning at 18th level, you can use it three times between rests. When you finish a short or long rest, you regain your expended uses.
          `,
      },
      {
        name: 'Channel Divinity Turn Undead',
        level: 2,
        description: `
          As an action, you present your holy symbol and speak a prayer censuring the undead. Each undead that can see or hear you within 30 feet of you must make a Wisdom saving throw. If the creature fails its saving throw, it is turned for 1 minute or until it takes any damage.

          A turned creature must spend its turns trying to move as far away from you as it can, and it can't willingly move to a space within 30 feet of you. It also can't take reactions. For its action, it can use only the Dash action or try to escape from an effect that prevents it from moving. If there's nowhere to move, the creature can use the Dodge action.
          `,
      },
      {
        name: 'Harness Divine Power',
        level: 2,
        description: `
          At 2nd level, you can expend a use of your Channel Divinity to fuel your spells. As a bonus action, you touch your holy symbol, utter a prayer, and regain one expended spell slot, the level of which can be no higher than half your proficiency bonus (rounded up). The number of times you can use this feature is based on the level you've reached in this class: 2nd level, once; 6th level, twice; and 18th level, thrice. You regain all expended uses when you finish a long rest.
          `,
      },
      {
        name: 'Ability Score Improvement',
        level: 4,
        description: `
          When you reach 4th level, and again at 8th, 12th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
          `,
      },
      {
        name: 'Destroy Undead',
        level: 5,
        description: `
          Starting at 5th level, when an undead fails its saving throw against your Turn Undead feature, the creature is instantly destroyed if its challenge rating is at or below a certain threshold, as shown in the Cleric table above.          `,
      },
      {
        name: 'Blessed Strikes',
        level: 8,
        description: `
          Replaces the Divine Strike or Potent Spellcasting feature

          When you reach 8th level, you are blessed with divine might in battle. When a creature takes damage from one of your cantrips or weapon attacks, you can also deal 1d8 radiant damage to that creature. Once you deal this damage, you can't use this feature again until the start of your next turn.
        `,
      },
      {
        name: 'Ability Score Improvement',
        level: 8,
        description: `
          When you reach 4th level, and again at 8th, 12th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.  
          `,
      },
      {
        name: 'Divine Intervention',
        level: 10,
        description: `
          Beginning at 10th level, you can call on your deity to intervene on your behalf when your need is great.

          Imploring your deity's aid requires you to use your action. Describe the assistance you seek, and roll percentile dice. If you roll a number equal to or lower than your cleric level, your deity intervenes. The GM chooses the nature of the intervention; the effect of any cleric spell or cleric domain spell would be appropriate.

          If your deity intervenes, you can't use this feature again for 7 days. Otherwise, you can use it again after you finish a long rest.

          At 20th level, your call for intervention succeeds automatically, no roll required.
        `,
      },
    ],
  };

  private notImplementedYet: any = {
    title: 'Not implemented yet',
    description: `
    This class is not implemented yet. Please check back later.
    `,
    features: [],
  };
}
