Skip to content

[lab-data-vikings] Miguel Ceinos#124

Open
MdeMaic wants to merge 6 commits intoironhack-datalabs:masterfrom
MdeMaic:lab-data-vikings
Open

[lab-data-vikings] Miguel Ceinos#124
MdeMaic wants to merge 6 commits intoironhack-datalabs:masterfrom
MdeMaic:lab-data-vikings

Conversation

@MdeMaic
Copy link
Copy Markdown

@MdeMaic MdeMaic commented Jan 19, 2020

i-have-no-idea-what-Im-doing-meme-11

🚀

@Clapiniella
Copy link
Copy Markdown

Hellosi!

Muy bueno ese teletransporte! Si no te va bien con el mundo del Data, ya sabes... 🚀

Cuando defines el método receiveDamage de Vikings y de Saxons, si que es conveniente que herede de Soldier, y añadas las modificaciones, en vez de volver a definir toda la función.

 def receiveDamage(self, damage):
        super().receiveDamage(damage)
        if self.health > 0: 
            return "{} has received {} points of damage".format(self.name, damage)
        else: 
            return "{} has died in act of combat".format(self.name)

Por último, comentarte que cuando haces lo siguiente:

status = ""
        
        if len(self.saxonArmy) == 0:
            status = "Vikings have won the war of the century!"
        elif len(self.vikingArmy) == 0:
            status = "Saxons have fought for their lives and survive another day..."
        else:
            status = "Vikings and Saxons are still in the thick of battle."
            
        return status

puedes hacerlo de esta manera, usando return para cada condición:

        if len(self.saxonArmy) <= 0: 
            return "Vikings have won the war of the century!"
        elif len(self.vikingArmy) <= 0: 
            return "Saxons have fought for their lives and survive another day..."
        elif len(self.saxonArmy) > 0 and len(self.vikingArmy) > 0: 
            return "Vikings and Saxons are still in the thick of battle."

Pero para haber estado en Galicia está moi ben

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants