#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pytest
from dnd_character_sheet.sheets.Character import Character, CharacterClass , CharacterAlignment, CharacterRace

__author__ = "<NAME>"
__copyright__ = "<NAME>"
__license__ = "mit"


def test_new_character():
    character = Character()
    assert character.getExperience() == 0, "A new character has 0 experience, aka adventurer in 'cass integration'"
    assert character.getLevel() == 1, "A new character starts from level 1"
    assert character.getClass() == CharacterClass.NO_CLASS, "A new character has no class"
    assert character.getAlignment() == CharacterAlignment.NO_ALIGNMENT, " A new character has no alignment"
    assert character.getRace() == CharacterRace.NO_RACE, " A new character has no race"

def test_character_experience_gain():
    character = Character()
    character.setClass(CharacterClass.MONK)
    assert character.getClass() == CharacterClass.MONK
    character.addExperience(300)
    assert character.getLevel() == 2, "When the character reaches 300 experience, level increases to 2"
    character.addExperience(599)
    assert character.getLevel() == 2, "When the character reaches 899 experience, level is still 2"
    character.addExperience(1)
    assert character.getLevel() == 3, "When the character reaches 900 experience, level rises to 3"


def test_unvalid_character_levels():
    character = Character()
    character.addExperience(380000)
    assert character.getLevel() is None, "A character can't go over 355000, over-experienced warriors can't find a job"

def test_energy():
    character = Character()
    # Di default hai messo l'energia a 100
    # Quindi non ti serve ridefinirla ancora
    # Il nome actual energy non è il massimo
    # quello che fa quella funzione è applicare un danno
    # all'energia del personaggio
    # può essere character.danneggia(10)

    
    character.applyDamage(10)
    assert character.getEnergy() == 90
    character.applyDamage(20)
    character.applyDamage(30)
    assert character.getEnergy() == 40
    character.applyDamage(50)
    assert character.getEnergy() == -10



#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pytest
from dnd_character_sheet.sheets.Character import Character, CharacterClass , CharacterAlignment, CharacterRace

__author__ = "<NAME>"
__copyright__ = "<NAME>"
__license__ = "mit"


def test_new_character():
    character = Character()
    assert character.getExperience() == 0, "A new character has 0 experience, aka adventurer in 'cass integration'"
    assert character.getLevel() == 1, "A new character starts from level 1"
    assert character.getClass() == CharacterClass.NO_CLASS, "A new character has no class"
    assert character.getAlignment() == CharacterAlignment.NO_ALIGNMENT, " A new character has no alignment"
    assert character.getRace() == CharacterRace.NO_RACE, " A new character has no race"

def test_character_experience_gain():
    character = Character()
    character.setClass(CharacterClass.MONK)
    assert character.getClass() == CharacterClass.MONK
    character.addExperience(300)
    assert character.getLevel() == 2, "When the character reaches 300 experience, level increases to 2"
    character.addExperience(599)
    assert character.getLevel() == 2, "When the character reaches 899 experience, level is still 2"
    character.addExperience(1)
    assert character.getLevel() == 3, "When the character reaches 900 experience, level rises to 3"


def test_unvalid_character_levels():
    character = Character()
    character.addExperience(380000)
    assert character.getLevel() is None, "A character can't go over 355000, over-experienced warriors can't find a job"

def test_energy():
    character = Character()
    # Di default hai messo l'energia a 100
    # Quindi non ti serve ridefinirla ancora
    # Il nome actual energy non è il massimo
    # quello che fa quella funzione è applicare un danno
    # all'energia del personaggio
    # può essere character.danneggia(10)

    
    character.applyDamage(10)
    assert character.getEnergy() == 90
    character.applyDamage(20)
    character.applyDamage(30)
    assert character.getEnergy() == 40
    character.applyDamage(50)
    assert character.getEnergy() == -10



#!/usr/bin/env python # -*- coding: utf-8 -*- # Di default hai messo l'energia a 100 # Quindi non ti serve ridefinirla ancora # Il nome actual energy non è il massimo # quello che fa quella funzione è applicare un danno # all'energia del personaggio # può essere character.danneggia(10)