Skip to content

Commit

Permalink
Arreglo bug de acumulacion de magos amarillos
Browse files Browse the repository at this point in the history
  • Loading branch information
MNVallone committed Oct 10, 2024
1 parent cf74977 commit 655c604
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 57 deletions.
5 changes: 0 additions & 5 deletions cursor.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,4 @@ object cursor {
method moverseArriba() = if (self.position().y()<4) position.goUp(1)
method moverseAbajo() = if (self.position().y()>0) position.goDown(1)

method noEstaViva() = vida < 0

method morir(){
if (self.noEstaViva()){ game.say(self, "Durisimo Helmano")} // Delego la resonsabilidad de morir a pepita
}
}
85 changes: 47 additions & 38 deletions magos.wlk
Original file line number Diff line number Diff line change
@@ -1,60 +1,66 @@
import puntaje.*

class MagoPiedra {
//nota de nico: es una nuez >:(
class MagoFuego {
const position
const property tipo = "piedra"
var property vida = 300
var property imagen = "magoPiedra.png"
const property tipo = "fuego"
var property vida = 100
var property danio = 40
var property imagen = "magoFuego.png"

method position() = position

method image() = imagen

method recibeDanio(danio) {
self.vida(self.vida() - danio)
method recibeDanio(_danio) {
self.vida(self.vida() - _danio)
}

method sigueViva(){
method sigueViva(){
if (vida <= 0) game.removeVisual(self)
}

method queSoy() = "mago"
}

class MagoFuego {
class MagoHealer {
const position
const property tipo = "fuego"
const property tipo = "girasol"
var property vida = 100
var property imagen = "magoFuego.png"
var property imagen = "magoHealer.png"

method position() = position

method danio() = 0

method image() = imagen

method recibeDanio(danio) {
self.vida(self.vida() - danio)
method recibeDanio(_danio) {
self.vida(self.vida() - _danio)
}

method sigueViva(){
if (vida <= 0) game.removeVisual(self)
}

if (vida <= 0 && game.hasVisual(self)){ // agregue el game.has visual porque sino restaba girasoles hasta que lo elimine el garbage collector
game.removeVisual(self)
puntaje.quitarMagoHealer()
}
}

method queSoy() = "mago"
}

class Patapum {
class MagoHielo {
const position
const property tipo = "patapum"
var property vida = 1
var property imagen = "magoEnojado.png" //hacer mago musulman
const property tipo = "cactus"
var property vida = 100
var property imagen = "magoHielo.png"

method position() = position

method image() = imagen

method recibeDanio(danio) {
self.vida(self.vida() - danio)
method recibeDanio(_danio) {
self.vida(self.vida() - _danio)
}

method sigueViva(){
Expand All @@ -64,11 +70,14 @@ class Patapum {
method queSoy() = "mago"
}

class MagoHielo {
class MagoPiedra {
//nota de nico: es una nuez >:(
const position
const property tipo = "cactus"
var property vida = 100
var property imagen = "magoHielo.png"
const property tipo = "piedra"
var property vida = 300
var property imagen = "magoPiedra.png"

method danio() = 0

method position() = position

Expand All @@ -85,18 +94,18 @@ class MagoHielo {
method queSoy() = "mago"
}

class MagoHealer {
class Patapum {
const position
const property tipo = "girasol"
var property vida = 50
var property imagen = "magoHealer.png"
const property tipo = "patapum"
var property vida = 1
var property imagen = "magoEnojado.png" //hacer mago musulman

method position() = position

method image() = imagen

method recibeDanio(danio) {
self.vida(self.vida() - danio)
method recibeDanio(_danio) {
self.vida(self.vida() - _danio)
}

method sigueViva(){
Expand All @@ -116,8 +125,8 @@ class MagoEnojado {

method image() = imagen

method recibeDanio(danio) {
self.vida(self.vida() - danio)
method recibeDanio(_danio) {
self.vida(self.vida() - _danio)
}

method sigueViva(){
Expand Down Expand Up @@ -188,7 +197,7 @@ object magoHealerTienda {
}

method efectoDeInvocacion(){
puntaje.sumarGirasol()
puntaje.sumarMagoHealer()
}

}
Expand Down Expand Up @@ -235,4 +244,4 @@ object magoEnojadoTienda {
method efectoDeInvocacion(){}
}

const pepe = new MagoFuego(position = game.at(0, 0))
// const pepe = new MagoFuego(position = game.at(0, 0))
1 change: 0 additions & 1 deletion main.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ program cursorGame {
game.onCollideDo(cursor, {elemento => game.say(elemento, "Duro de Cojones")})
game.onCollideDo(cursor, {elemento => cursor.perderVida(elemento.danio())})
*/
game.onTick(3000, "matar cursor", {if (cursor.noEstaViva()){cursor.morir()}})

game.onTick(1000, "aumentar dinerro", {puntaje.sumarPuntos()})
/*
Expand Down
36 changes: 31 additions & 5 deletions pruebas.wtest
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
/*import pepita.*
import magos.*
import game.*
describe "group of tests for magos" {

describe "group of tests for pepita" {
test "Mago Fuego tiene vida" {
const mago = new MagoFuego(position = game.at(0,0))
assert.equals(100, mago.vida())
}

test "Mago Fuego tiene daño" {
const mago = new MagoFuego(position = game.at(0,0))
assert.equals(40, mago.danio())
}

test "Mago Healer tiene vida" {
const mago = new MagoHealer(position = game.at(0,0))
assert.equals(100, mago.vida())
}

test "pepita has initial energy" {
assert.equals(2, pepita.vida())
test "Mago Healer no tiene daño" {
const mago = new MagoHealer(position = game.at(0,0))
assert.equals(0, mago.danio())
}
test "Mago Piedra tiene vida" {
const mago = new MagoPiedra(position = game.at(0,0))
assert.equals(300, mago.vida())
}

test "Mago Piedra no tiene daño" {
const mago = new MagoPiedra(position = game.at(0,0))
assert.equals(0, mago.danio())
}


} */
}
13 changes: 7 additions & 6 deletions puntaje.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ method position() = game.at(7, 5)

var property puntos = 50

var property cantidadDeGirasoles = 0
var property cantidadDeMagosHealer = 0

method sumarPuntos(){
self.puntos(puntos + 10 * (1 + cantidadDeGirasoles))
self.puntos(puntos + 10 * (1 + cantidadDeMagosHealer))
}

method restarPuntos(costo){
self.puntos(puntos - costo)
}

method sumarGirasol(){
self.cantidadDeGirasoles(cantidadDeGirasoles + 1)
method sumarMagoHealer(){
cantidadDeMagosHealer += 1
}

method quitarGirasol(){
self.cantidadDeGirasoles(cantidadDeGirasoles - 1)
method quitarMagoHealer(){
cantidadDeMagosHealer -= 1
if (cantidadDeMagosHealer <=0) cantidadDeMagosHealer = 0
}


Expand Down
4 changes: 2 additions & 2 deletions zombie.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class ZombiesNormales {

}

const jose = new ZombiesNormales(position= new MutablePosition(x=10, y=0.randomUpTo(5).truncate(0)))
//const jose = new ZombiesNormales(position= new MutablePosition(x=10, y=0.randomUpTo(5).truncate(0)))

const otroZombie = new ZombiesNormales(position= new MutablePosition(x=3, y=3))
//const otroZombie = new ZombiesNormales(position= new MutablePosition(x=3, y=3))

0 comments on commit 655c604

Please sign in to comment.