Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Stregone:
- danno_base: int = 500
- def __init__(self, nome: str, livello_salute: int) -> None:
- self.nome: str = nome
- self.livello_salute: int = livello_salute
- def attacca(self) -> int:
- return 300*self.danno_base
- class Pezzente:
- def attacca(self) -> int:
- return 1
- class StregoneSupremo(Stregone):
- def __init__(self, nome: str, danno_bonus: int = 1000) -> None:
- super().__init__(nome, 2000)
- self.danno_bonus: int = danno_bonus
- def attacca(self) -> int:
- return super().attacca() + self.danno_bonus
- stre_sup1 = StregoneSupremo("Sono il boss!", 10000)
- print(stre_sup1.nome)
- print(stre_sup1.livello_salute)
- print(stre_sup1.danno_bonus)
- print(stre_sup1.attacca())
- clan: list[Stregone] = [Stregone("Urgos", 100), stre_sup1, Stregone("Kandios", 300)]
- danno_attacco_gruppo: int = 0
- for streg in clan:
- danno_attacco_gruppo += streg.attacca()
- print(danno_attacco_gruppo)
- armata_brancaleone: list[Stregone | Pezzente] = \
- [Stregone("Urgos", 100), Pezzente(), stre_sup1, Stregone("Kandios", 300)]
- danno_attacco_gruppo = 0
- for personaggio in armata_brancaleone:
- danno_attacco_gruppo += personaggio.attacca()
- print(danno_attacco_gruppo)
Advertisement
Add Comment
Please, Sign In to add comment