示例#1
0
    def create_fleet(self):
        weapon1 = Weapon()
        weapon1.type = 'Laser Beam'
        weapon1.attack_power = 5

        weapon2 = Weapon()
        weapon2.type = 'Sonar Pulse'
        weapon2.attack_power = 5

        weapon3 = Weapon()
        weapon3.type = 'Chum-Bucket Gauntlets'
        weapon3.attack_power = 10

        robot1 = Robot()
        robot1.name = 'Megatron'
        robot1.health = 30
        robot1.weapon = weapon1
        robot1.power_level = 10

        robot2 = Robot()
        robot2.name = 'R2-D2'
        robot2.health = 20
        robot2.weapon = weapon2
        robot2.power_level = 10

        robot3 = Robot()
        robot3.name = 'Karen'
        robot3.health = 20
        robot3.weapon = weapon3
        robot3.power_level = 10

        robots = [robot1, robot2, robot3]
        return robots
示例#2
0
    def __init__(self):
        weapon_1 = Weapon()
        weapon_1.type = 'pistol'
        weapon_1.attack_power = 10

        weapon_2 = Weapon()
        weapon_2.type = 'tommy'
        weapon_2.attack_power = 20

        weapon_3 = Weapon()
        weapon_3.type = 'shotti'
        weapon_3.attack_power = 33