Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tarea 1 - Entrega Parcial 2 #2

Open
wants to merge 128 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
2059de3
FEAT add Personaje class
Baasty-OCh Apr 5, 2024
ccf69e9
REFACTOR: changed class 'PersonajeTest2' for 'PlayableTest'
Baasty-OCh Apr 6, 2024
876d063
REFACTOR: changed the package 'pj' for 'playable'
Baasty-OCh Apr 6, 2024
6e8121d
FEAT: added nonplayable trait
Baasty-OCh Apr 6, 2024
37732b4
FEAT: added playable trait
Baasty-OCh Apr 6, 2024
6ff4bb4
DOC: added methods 'sayName','sayLife','sayDefence','sayWeight','sayK…
Baasty-OCh Apr 6, 2024
d8e3fc4
DOC: added methods 'sayName','sayLife','sayDefence','sayWeight','sayK…
Baasty-OCh Apr 6, 2024
8ef9df8
TEST: added test 'equalsName' in class 'PlayableTest'
Baasty-OCh Apr 6, 2024
4da32eb
DOC: added method 'sayName' in class 'Character'
Baasty-OCh Apr 7, 2024
7bca4c0
DOC: added method 'sayLife' in class 'Character'
Baasty-OCh Apr 7, 2024
c752b77
DOC: added method 'sayDefence' in class 'Character'
Baasty-OCh Apr 7, 2024
435dc0f
DOC: added method 'sayWeight' in class 'Character'
Baasty-OCh Apr 7, 2024
ca2ac3e
REFACTOR: changed all instances of method 'checkWeapon' for put 'putW…
Baasty-OCh Apr 7, 2024
c898f9b
TEST: added test 'NotequalsName' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
0ee178e
TEST: added test 'equalsLife' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
945630b
TEST: added test 'NotEqualsLife' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
b3c6089
TEST: added test 'equalsDefence' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
7167c40
TEST: added test NotEqualsDefence' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
51c9bd3
TEST: added test 'equalsWeight' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
bb62954
TEST: added test NotEqualsWeight' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
00cadf0
TEST: added test 'equalsKind' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
6badacf
TEST: added test NotEqualsKind' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
02dc737
TEST: added test 'equalsWeapon' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
e2299ce
TEST: added test NotEqualsWeapon' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
fc5d741
FEAT: added class 'MagicCharacter' in package 'playable'
Baasty-OCh Apr 7, 2024
3dbd21f
DOC: added methods 'sayName','sayLife','sayDefence','sayWeight','sayK…
Baasty-OCh Apr 7, 2024
6aca872
DOC: added method 'sayMana' in class 'MagicCharacter'
Baasty-OCh Apr 7, 2024
ba1312f
TEST: added test 'equalsMana' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
4b737d5
TEST: added test NotEqualsMana' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
d9f36d3
TEST: added test 'equalsMagicKind' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
82d97d1
TEST: added test NotEqualsMagicKind' in class 'PlayableTest'
Baasty-OCh Apr 7, 2024
b389ec7
FEAT: deleted methods 'sayName','sayLife','sayDefence','sayWeight','s…
Baasty-OCh Apr 7, 2024
5dd75c7
FEAT: added method 'sayName' in trait 'NonPlayable' in package 'nonp…
Baasty-OCh Apr 7, 2024
d51f916
FEAT: added method 'sayWeight' in trait 'NonPlayable' in package 'no…
Baasty-OCh Apr 7, 2024
f3beff6
FEAT: added method 'sayAttack' in trait 'NonPlayable' in package 'no…
Baasty-OCh Apr 7, 2024
89732fc
FEAT: added class 'weapon' in package 'nonplayable'
Baasty-OCh Apr 7, 2024
4e17441
REFACTOR: changed all instances of class 'weapon' for put 'Weapon' in…
Baasty-OCh Apr 7, 2024
6695efb
FEAT: added method 'sayName' in class 'Weapon' in package 'nonplayable'
Baasty-OCh Apr 7, 2024
7dbfe93
FEAT: added method 'sayWeight' in class 'Weapon' in package 'nonplay…
Baasty-OCh Apr 7, 2024
a5e362b
FEAT: added method 'sayAttack' in class 'Weapon' in package 'nonplay…
Baasty-OCh Apr 7, 2024
5c80b54
REFACTOR: changed all instances of trait 'Nonplayable' for put 'NonPl…
Baasty-OCh Apr 7, 2024
07aafc6
FEAT: added class 'NonPlayableTest' in package 'test'
Baasty-OCh Apr 7, 2024
932c0b0
TEST: added test 'equalsName' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
a8d84f3
TEST: added test 'NotEqualsName' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
d75be85
TEST: added test 'equalsWeight' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
cb4ca05
TEST: added test 'NotEqualsWeight' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
3ef4281
TEST: added test 'equalsAttack' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
39524ee
TEST: added test 'NotEqualsAttack' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
8975158
FEAT: added class 'MagicWeapon' in package 'nonplayable'
Baasty-OCh Apr 7, 2024
08f907a
FEAT: added method 'sayMana' in class 'MagicWeapon' in package 'nonp…
Baasty-OCh Apr 7, 2024
a78e4b8
TEST: added test 'equalsMana' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
9b7f7f9
TEST: added test 'NotEqualsMana' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
71da2ac
REFACTOR: changed all instances of var 'ataque' for put 'mana' in tes…
Baasty-OCh Apr 7, 2024
70294c6
FEAT: added method 'sayOwner' in class 'Weapon' in package 'nonplaya…
Baasty-OCh Apr 7, 2024
11061c4
TEST: added test 'equalsOwner' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
89be0f2
FEAT: override method 'sayOwner' in class 'MagicWeapon' in package '…
Baasty-OCh Apr 7, 2024
6668b27
FEAT: deleted method 'sayOwner' in class 'MagicWeapon' in package 'n…
Baasty-OCh Apr 7, 2024
589f280
FEAT: added methods 'sayMagicOwner','sayMana','sayName','sayWeight',…
Baasty-OCh Apr 7, 2024
6527442
TEST: added test 'equalsMagicOwner' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
faa0bc7
TEST: added test 'NotEqualsMagicOwner' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
e6f2879
FEAT: added class 'Enemy' in package 'nonplayable'
Baasty-OCh Apr 7, 2024
9eecf39
FEAT: added methods 'sayLife','sayDefence','sayName','sayWeight','sa…
Baasty-OCh Apr 7, 2024
353a2e8
TEST: added test 'EqualsEnemyName' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
e0afa60
REFACTOR: changed test 'EqualsEnemyName for 'equalsEnemyName' in clas…
Baasty-OCh Apr 7, 2024
048249e
TEST: added test 'NotEqualsEnemyName' in class 'NonPlayableTest'
Baasty-OCh Apr 7, 2024
0036a5f
FEAT: added class 'WeaponTest' in package 'test'
Baasty-OCh Apr 7, 2024
1570b11
FEAT: added class 'MagicWeaponTest' in package 'test'
Baasty-OCh Apr 7, 2024
ecdda6b
REFACTOR: changed class 'NonPlayableTest' for 'EnemyTest' in package …
Baasty-OCh Apr 7, 2024
4a7cb95
FEAT: added test 'equalsName','NotEqualsName', 'equalsWeight','NotEqu…
Baasty-OCh Apr 7, 2024
d96e786
FEAT: added test 'equalsMana','NotEqualsMana', 'equalMagicOwner', 'No…
Baasty-OCh Apr 7, 2024
5e8172e
FEAT: deleted test 'equalsMana','NotEqualsMana', 'equalMagicOwner', '…
Baasty-OCh Apr 7, 2024
aa96c51
FEAT: added test 'equalsName','NotEqualsName', 'equalsWeight','NotEqu…
Baasty-OCh Apr 7, 2024
f6b0762
FEAT: added test 'equalsName','NotEqualsName', 'equalsWeight','NotEqu…
Baasty-OCh Apr 7, 2024
1fb9131
REFACTOR: edited methods 'sayName', 'sayLife','sayDefence', 'sayWeigh…
Baasty-OCh Apr 12, 2024
d2834ad
REFACTOR: edited methods 'sayName', 'sayLife','sayDefence', 'sayWeigh…
Baasty-OCh Apr 12, 2024
0e2f644
REFACTOR: added methods 'sayName', 'sayLife','sayDefence', 'sayWeight…
Baasty-OCh Apr 12, 2024
2860925
REFACTOR: edited test 'equalsName','NotequalsName','equalsLife','Note…
Baasty-OCh Apr 12, 2024
c0839f0
REFACTOR: edited test 'equalsMagicKind','NotequalsMagicKind'and delet…
Baasty-OCh Apr 12, 2024
324f3f3
REFACTOR: edited methods 'sayName' 'sayWeight' and 'sayAttack' in tra…
Baasty-OCh Apr 12, 2024
87be12b
REFACTOR: edited methods 'sayName', 'sayLife','sayDefence', 'sayWeigh…
Baasty-OCh Apr 12, 2024
369e30f
REFACTOR: edited methods 'sayName', 'sayAttack','sayDefence', 'sayWei…
Baasty-OCh Apr 12, 2024
91c9bb8
REFACTOR: edited methods 'sayName', 'sayAttack','sayDefence', 'sayWei…
Baasty-OCh Apr 12, 2024
ed6da5e
REFACTOR: edited test 'equalsName','NotequalsName','equalsLife','Note…
Baasty-OCh Apr 12, 2024
ae3d927
REFACTOR: edited test 'equalsName','NotequalsName','equalsMana','Note…
Baasty-OCh Apr 12, 2024
d0f854a
REFACTOR: edited test 'equalsName','NotequalsName',,'equalsOwner','No…
Baasty-OCh Apr 12, 2024
36107c0
REFACTOR: override method equals in class 'Character' in 'playable' p…
Baasty-OCh Apr 12, 2024
0e57eb8
REFACTOR: override method equals in class 'MagicCharacter' in 'playab…
Baasty-OCh Apr 12, 2024
9de2508
REFACTOR: added test 'equals' and 'NotEquals' in Test 'PlayableTest'
Baasty-OCh Apr 12, 2024
06db54e
REFACTOR: added test 'equalsMagicCharacter' and 'NotEqualsMagicCharac…
Baasty-OCh Apr 12, 2024
09dd495
REFACTOR: added 4 cast in method equals in class 'Character' in 'play…
Baasty-OCh Apr 12, 2024
61dab3e
DOC: splited 'PlayableTest' in 'CharacterTest' and 'MagicCharacterTest'
Baasty-OCh Apr 13, 2024
9736143
TEST: added test 'equalsMana','NotEqualsMana', 'equalsMagicKind', 'No…
Baasty-OCh Apr 13, 2024
569f5e0
REFACTOR: changed name of 'PlayableTest' for 'CharacterTest' in packa…
Baasty-OCh Apr 13, 2024
27888b0
TEST: added test 'equalsName','NotEqualsName' in class 'MagicCharacte…
Baasty-OCh Apr 13, 2024
f937dde
TEST: added test 'equalsLife','NotEqualsLife' in class 'MagicCharacte…
Baasty-OCh Apr 13, 2024
3987ad6
TEST: added test 'equalsDefence','NotEqualsDefence', 'equalsWeight','…
Baasty-OCh Apr 13, 2024
38554b6
TEST: added test 'haveWeapon', 'haveNotWeapon' in class 'MagicCharact…
Baasty-OCh Apr 13, 2024
5510302
TEST: added test 'haveWeapon', 'haveNotWeapon' in class 'CharacterTest'
Baasty-OCh Apr 13, 2024
46f75bb
TEST: added test 'equalsMagicOwner' in class 'MagicWeaponTest'
Baasty-OCh Apr 13, 2024
b032b36
REFACTOR: added method 'addCharacter' in class 'Party' in package model
Baasty-OCh Apr 13, 2024
8a4edf5
REFACTOR: changed method 'addCharacter' for 'addPlayable' in class 'P…
Baasty-OCh Apr 13, 2024
d1311c1
REFACTOR: changed all instance of var 'character' for 'pj' in method…
Baasty-OCh Apr 13, 2024
b1abc31
DOC: added 'PartyTest' in scala.test
Baasty-OCh Apr 13, 2024
1759fe3
FEAT: added var Team1 in PartyTest class
Baasty-OCh Apr 13, 2024
e071223
FEAT: added var 'Cristiano' and ' Alexis' in PartyTest class
Baasty-OCh Apr 13, 2024
8d56dc9
TEST: added test 'addPersonaje' in class 'PartyTest'
Baasty-OCh Apr 13, 2024
91759f1
TEST: added test 'addMagicCharacter' in class 'PartyTest'
Baasty-OCh Apr 13, 2024
652e3d1
TEST: added test 'isEmpty' in class 'PartyTest'
Baasty-OCh Apr 13, 2024
1802621
TEST: added test 'isDefeat' in class 'PartyTest'
Baasty-OCh Apr 13, 2024
9a5b5ad
TEST: added test 'isNotDefeat' in class 'PartyTest'
Baasty-OCh Apr 13, 2024
8432f0e
DOC: Document all my code of 'PartyTest in English.
Baasty-OCh Apr 13, 2024
a44f810
DOC: Document all my code of 'MagicCharacterTest' and 'CharacterTest'…
Baasty-OCh Apr 13, 2024
1f336d7
DOC: Document all my code of 'WeaponTest' in English.
Baasty-OCh Apr 13, 2024
abff0e6
DOC: Document all my code of 'EnemyTest' in English.
Baasty-OCh Apr 13, 2024
792372f
DOC: Document all my code of 'MagicWeaponTest' in English.
Baasty-OCh Apr 13, 2024
a2ebacc
DOC: Document all my code of class 'MagicCharacter' in English.
Baasty-OCh Apr 13, 2024
ff3052c
DOC: Document all my code of class 'Character' in English.
Baasty-OCh Apr 13, 2024
59577b6
DOC: Document all my code of class 'Party' in English.
Baasty-OCh Apr 13, 2024
acecb52
DOC: Document all my code of trait 'NonPlayable' in English.
Baasty-OCh Apr 13, 2024
7470a94
DOC: Document all my code of class 'Weapon' in English.
Baasty-OCh Apr 13, 2024
9fd2a7a
DOC: Document all my code of class 'MagicWeapon' in English.
Baasty-OCh Apr 13, 2024
5be2492
DOC: Document all my code of class 'Enemy' in English.
Baasty-OCh Apr 13, 2024
4230bec
REFACTOR: moved 'WeaponTest', 'EnemyTest', 'MagicWeaponTest' to new p…
Baasty-OCh Apr 22, 2024
9161538
DOC: I wrote my read.me
Baasty-OCh Apr 23, 2024
313d2ed
DOC: I created class Controller
Baasty-OCh Apr 23, 2024
ac8fa13
FEAT: created abstrac class 'APlayable' and changed the class 'Charac…
Baasty-OCh Apr 23, 2024
b2ab71c
FEAT: created classes 'MagoNegro' and ' MagoBlanco', i changed all in…
Baasty-OCh Apr 23, 2024
0e49fac
FEAT: added some comments in 'Controller' class
Baasty-OCh Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Final Reality is a simplified clone of the renowned game, Final Fantasy. Its main purpose is to
serve as an educational tool, teaching foundational programming concepts.

this game will be selling more than final fantasy...

This README is yours to complete it. Take this opportunity to describe your contributions, the
design decisions you've made, and any other information you deem necessary.

Expand Down
14 changes: 14 additions & 0 deletions src/main/scala/model/controller/Controller.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package model.controller


class Controller {
// tuve problemas con mi licencia de intellij, lo solucione hoy y no me dio tiempo a terminar esta parte
// si arreglé varias cosas que no estaban del buenas en la entrega parcial 1
// el cuerpo docente ya esta al tanto de la situacion





}

33 changes: 33 additions & 0 deletions src/main/scala/model/nonplayable/Enemy.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package model.nonplayable
import model.nonplayable.NonPlayable

// Enemy class represents a non-playable entity that is an enemy
class Enemy(name: String, weight: Int,
attack: Int, life: Int,
defence: Int) extends NonPlayable {

// Method to return the name of the enemy
def sayName(): String = {
name
}

// Method to return the weight of the enemy
def sayWeight(): Int = {
weight
}

// Method to return the attack power of the enemy
def sayAttack(): Int = {
attack
}

// Method to return the life points of the enemy
def sayLife(): Int = {
life
}

// Method to return the defence points of the enemy
def sayDefence(): Int = {
defence
}
}
35 changes: 35 additions & 0 deletions src/main/scala/model/nonplayable/MagicWeapon.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package model.nonplayable
import model.nonplayable.NonPlayable
import model.playable.APlayable

// MagicWeapon class represents a non-playable entity that is a magic weapon
class MagicWeapon(name: String, weight: Int,
attack: Int, mana: Int,
owner: APlayable) extends NonPlayable {

// Method to return the mana points required to use the magic weapon
def sayMana(): Int ={
mana
}

// Method to return the name of the magic weapon
def sayName(): String = {
name
}

// Method to return the weight of the magic weapon
def sayWeight(): Int = {
weight
}

// Method to return the attack power of the magic weapon
def sayAttack(): Int = {
attack
}

// Method to return the owner character of the magic weapon
def sayOwner(): APlayable = {
owner
}
}

14 changes: 14 additions & 0 deletions src/main/scala/model/nonplayable/NonPlayable.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package model.nonplayable

// Trait to represent non-playable entities
trait NonPlayable {
// Abstract method to get the name of the non-playable entity
def sayName(): String

// Abstract method to get the weight of the non-playable entity
def sayWeight(): Int

// Abstract method to get the attack power of the non-playable entity
def sayAttack(): Int
}

28 changes: 28 additions & 0 deletions src/main/scala/model/nonplayable/Weapon.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package model.nonplayable
import model.nonplayable.NonPlayable
import model.playable.APlayable

// Weapon class represents a non-playable entity that is a weapon
class Weapon(name: String, weight: Int,
attack: Int, owner: Character) extends NonPlayable {

// Method to return the owner character of the weapon
def sayOwner(): Character = {
owner
}

// Method to return the name of the weapon
def sayName(): String = {
name
}

// Method to return the weight of the weapon
def sayWeight(): Int = {
weight
}

// Method to return the attack power of the weapon
def sayAttack(): Int = {
attack
}
}
27 changes: 27 additions & 0 deletions src/main/scala/model/party/Party.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package model.party

import model.playable.{APlayable}

import scala.collection.mutable.Map

// Party class to manage a group of playable characters
class Party {
// Map to store the allies in the party, keyed by their kind/type
val allies: Map[String, APlayable] = Map()

// Method to add a playable character to the party
def addPlayable(pj: APlayable): Unit = {
allies.put(pj.sayKind(), pj) // Adds the playable character to the allies map with their kind as the key
}

// Method to check if the party is defeated
def isDefeated: Boolean = {
if (allies.isEmpty) {
// Print a message if the party is empty
true // The party is considered defeated if it's empty
} else {
// The party is considered defeated if all allies have 0 life points
allies.values.forall(_.sayLife() == 0)
}
}
}
42 changes: 42 additions & 0 deletions src/main/scala/model/playable/APlayable.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package model.playable
import model.playable.Playable
abstract class APlayable(val name: String, var life: Int,
val defence: Int, val weight: Int,
var kind: String, var weapon: Boolean, val mana: Int) extends Playable {

// Method to return the name of the character
def sayName(): String = {
name
}

// Method to return the life points of the character
def sayLife(): Int = {
life
}

// Method to return the defense points of the character
def sayDefence(): Int = {
defence
}

// Method to return the weight of the character
def sayWeight(): Int = {
weight
}

// Method to return the kind/type of the character
def sayKind(): String = {
kind
}

// Method to check if the character has a weapon
def havWeapon(): Boolean = {
weapon
}
def sayMana(): Int = {
mana
}


}

25 changes: 25 additions & 0 deletions src/main/scala/model/playable/Character.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package model.playable
import model.playable.Playable
import model.playable.APlayable
// Character class extends the Playable trait
class Paladin(name:String) extends APlayable(name,100,50,50,"Paladin",false,0) {

}
class Guerrero(name:String) extends APlayable(name,120,80,40,"Guerrero",false,0) {

}
class Ninja(name:String) extends APlayable(name,50,80,20,"Ninja",false,0) {

}
class MagoNegro(name:String) extends APlayable(name,100,100,120,"MagoNegro",false,50) {

}

class MagoBlanco(name:String) extends APlayable(name,50,150,100,"MagoBlanco",false,80) {

} // Override equals method to compare two characters based on their attributes





4 changes: 4 additions & 0 deletions src/main/scala/model/playable/MagicCharacter.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package model.playable
import model.playable.APlayable

// MagicCharacter class extends the Playable trait
22 changes: 22 additions & 0 deletions src/main/scala/model/playable/Playable.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package model.playable

trait Playable {
// Abstract method to get the name of the playable entity
def sayName(): String

// Abstract method to get the life points of the playable entity
def sayLife(): Int

// Abstract method to get the defense points of the playable entity
def sayDefence(): Int

// Abstract method to get the weight of the playable entity
def sayWeight(): Int

// Abstract method to get the kind/type of the playable entity
def sayKind(): String

// Abstract method to check if the playable entity has a weapon
def havWeapon(): Boolean

}
48 changes: 48 additions & 0 deletions src/test/scala/PartyTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import munit.FunSuite
import model.party.Party
import model.playable.{APlayable,Paladin,Guerrero,Ninja,MagoBlanco,MagoNegro}
import model.nonplayable.{Enemy, MagicWeapon, Weapon}
class PartyTest extends FunSuite {
var Team1: Party = _ // We declare a variable Team1 of type Party
var Cristiano: APlayable = _ // We declare a variable Cristiano of type Playable
var Alexis: APlayable = _ // We declare a variable Alexis of type Playable


override def beforeEach(context: BeforeEach): Unit = {
Team1 = new Party() // Creates a new instance of the Party class and assigns it to the variable Team1.
// Creates a new instance of the Character class with the specified parameters:
Cristiano = new Paladin("Cristiano")

// Creates a new instance of the MagicCharacter class with the specified parameters:
Alexis = new MagoBlanco("Alexis")// - Kind: Mago Blanco // - Weapon: false

}
test("addCharacter") { // Test the method to add a character
Team1.addPlayable(Cristiano) // Add the character Cristiano
val expected: Map[String, APlayable] = Map("Paladin" -> Cristiano) // The expected variable will be a map with the type and name of the character
assertEquals(Team1.allies.toMap, expected) // Compare the result with the Map
}

test("isEmpty") { // Test if the team is initially empty
var state: Boolean = Team1.isDefeated // Create a variable 'state' that stores the result of checking if a party is defeated
assertEquals(state, true) // Compare the results
}
test("isDefeat") { // Test if a party is defeated or not
Cristiano.life = 0
Team1.addPlayable(Cristiano) // Add a character with zero health
Alexis.life = 0
Team1.addPlayable(Alexis) // Add a magic character with zero health
assertEquals(Team1.isDefeated, true) // Check if they are defeated or not (a team with no health is defeated) -> true
}
test("isNotDefeat") { // Test if a party is not defeated
Team1.addPlayable(Cristiano) // Add a character with zero health
Alexis = new MagoBlanco("Alexis")
Team1.addPlayable(Alexis) // Add that living character
assertEquals(Team1.isDefeated, false) // Check that the team is alive (false)
}





}
76 changes: 76 additions & 0 deletions src/test/scala/nonplayable/EnemyTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package nonplayable

import model.nonplayable.Enemy
import munit.FunSuite
class EnemyTest extends FunSuite {
var Neymar: Enemy = _ // We declare a variable Neymar of type Enemy
var Bale: Enemy = _ // We declare a variable Bale of type Enemy

override def beforeEach(context: BeforeEach): Unit = {
// Creates a new instance of the Enemy class with the specified parameters:
Neymar = new Enemy("Neymar", 60, 90, 70, 30) // -Name : Neymar // - Weight: 60 // - Attack: 90 // - Life: 70 // - Defence: 30
// Creates a new instance of the Enemy class with the specified parameters:
Bale = new Enemy("Bale", 70, 85, 75, 50) // -Name : Bale // - Weight: 70 // - Attack: 85 // - Life: 75 // - Defence: 50

}

test("equalsEnemyName") { // Test if the returned name value for an enemy matches the expected value
var name: String = Neymar.sayName() // Retrieve the name value of the enemy Neymar and store it in the 'name' variable
var expected: String = "Neymar" // Define the expected name value
assertEquals(name, expected) // Compare the actual name value with the expected value
}

test("NotEqualsEnemyName") { // Test if the name values of two different enemies are not equal
var name1: String = Neymar.sayName() // Retrieve the name value of the enemy Neymar and store it in the 'name1' variable
var name2: String = Bale.sayName() // Retrieve the name value of the enemy Bale and store it in the 'name2' variable
assertNotEquals(name1, name2) // Assert that the name values of Neymar and Bale are not equal
}

test("equalsWeight") { // Test if the returned weight value for an enemy matches the expected value
var weight = Neymar.sayWeight() // Retrieve the weight value of the enemy Neymar and store it in the 'weight' variable
var expected: Int = 60 // Define the expected weight value
assertEquals(weight, expected) // Compare the actual weight value with the expected value
}

test("NotEqualsWeight") { // Test if the weight values of two different enemies are not equal
var weight1 = Neymar.sayWeight() // Retrieve the weight value of the enemy Neymar and store it in the 'weight1' variable
var weight2 = Bale.sayWeight() // Retrieve the weight value of the enemy Bale and store it in the 'weight2' variable
assertNotEquals(weight1, weight2) // Assert that the weight values of Neymar and Bale are not equal
}

test("equalsAttack") { // Test if the returned attack value for an enemy matches the expected value
var attack = Neymar.sayAttack() // Retrieve the attack value of the enemy Neymar and store it in the 'attack' variable
var expected: Int = 90 // Define the expected attack value
assertEquals(attack, expected) // Compare the actual attack value with the expected value
}

test("NotEqualsAttack") { // Test if the attack values of two different enemies are not equal
var attack1 = Neymar.sayAttack() // Retrieve the attack value of the enemy Neymar and store it in the 'attack1' variable
var attack2 = Bale.sayAttack() // Retrieve the attack value of the enemy Bale and store it in the 'attack2' variable
assertNotEquals(attack1, attack2) // Assert that the attack values of Neymar and Bale are not equal
}

test("equalsLife") { // Test if the returned life value for an enemy matches the expected value
var life = Neymar.sayLife() // Retrieve the life value of the enemy Neymar and store it in the 'life' variable
var expected: Int = 70 // Define the expected life value
assertEquals(life, expected) // Compare the actual life value with the expected value
}

test("NotEqualsLife") { // Test if the life values of two different enemies are not equal
var life1 = Neymar.sayLife() // Retrieve the life value of the enemy Neymar and store it in the 'life1' variable
var life2 = Bale.sayLife() // Retrieve the life value of the enemy Bale and store it in the 'life2' variable
assertNotEquals(life1, life2) // Assert that the life values of Neymar and Bale are not equal
}

test("equalsDefence") { // Test if the returned defense value for an enemy matches the expected value
var defense = Neymar.sayDefence() // Retrieve the defense value of the enemy Neymar and store it in the 'defense' variable
var expected: Int = 30 // Define the expected defense value
assertEquals(defense, expected) // Compare the actual defense value with the expected value
}

test("NotEqualsDefence") { // Test if the defense values of two different enemies are not equal
var defense1 = Neymar.sayDefence() // Retrieve the defense value of the enemy Neymar and store it in the 'defense1' variable
var defense2 = Bale.sayDefence() // Retrieve the de

}
}
Loading