Exemplo n.º 1
0
 def create_hero(self,name):
     if name=="Jinx":
         return Jinx()
     elif name=="EZ":
         return EZ()
     elif name=="Timo":
         return Timo()
     elif name=="Police":
         return Police()
     else:
         raise Exception(f"没有此英雄,不在英雄工厂中")
Exemplo n.º 2
0
 def crate_hero(name):
     if name == "JINX":
         return JINX()
     elif name == "EZ":
         return EZ()
     elif name == "Timo":
         return Timo()
     elif name == "Police":
         return Police()
     else:
         raise Exception("英雄名称不存在")
Exemplo n.º 3
0
def test_hero():
	police = Police()
	timo = Timo()

	timo.fight(police.name,police.hp,police.power)
	timo.speak_lines()
	police.speak_lines()
Exemplo n.º 4
0
from police import Police
from timo import Timo

police = Police()
timo = Timo()
police.fight(timo.name, timo.hp, timo.power)
police.speak_lines()
timo.speak_lines()
Exemplo n.º 5
0
from Python脚本编写与实战作业.jinx import Jinx
from Python脚本编写与实战作业.ez import EZ
from police import Police
from timo import Timo

if __name__ == '__main__':
    ez = EZ()
    jinx = Jinx()
    timo = Timo()
    police = Police()
    ez.speak_lines("我是EZ,我就是打败天下无敌手")
    jinx.speak_lines("Jinx来也")

    ez.fight(jinx.hp, jinx.power)
    jinx.fight(ez.hp, ez.power)

    timo.speak_lines("提莫队长正在待命")
    police.speak_lines("见识一下法律的子弹")