コード例 #1
0
 def test_vampyre_take_damage_3(self):
     vampyre = Vampyre('Drakula')  # hit_points=12, lives=3
     vampyre.take_damage(25)
     self.assertEqual(vampyre.hit_points, 11)
     self.assertEqual(vampyre.lives, 1)
     vampyre.take_damage(17)
     self.assertEqual(vampyre.hit_points, 0)
     self.assertEqual(vampyre.lives, 0)
コード例 #2
0
    def test_vampyre_take_damage_4(self):
        vampyre = Vampyre('Drakula')  # hit_points=12, lives=3
        vampyre.take_damage(damage=12)
        self.assertEqual(vampyre.lives, 2)
        self.assertEqual(vampyre.hit_points, 12)

        vampyre.take_damage(damage=6)
        self.assertEqual(vampyre.lives, 2)
        self.assertEqual(vampyre.hit_points, 6)

        vampyre.take_damage(damage=3)
        self.assertEqual(vampyre.lives, 2)
        self.assertEqual(vampyre.hit_points, 3)

        vampyre.take_damage(damage=5)
        self.assertEqual(vampyre.lives, 1)
        self.assertEqual(vampyre.hit_points, 10)

        vampyre.take_damage(damage=7)
        self.assertEqual(vampyre.lives, 1)
        self.assertEqual(vampyre.hit_points, 3)

        vampyre.take_damage(damage=18)
        self.assertEqual(vampyre.lives, 0)
        self.assertEqual(vampyre.hit_points, 0)

        vampyre.take_damage(damage=1)
        self.assertEqual(vampyre.lives, 0)
        self.assertEqual(vampyre.hit_points, 0)
コード例 #3
0
 def test_vampyre_take_damage_1(self):
     vampyre = Vampyre('Drakula')
     vampyre.take_damage(36)
     self.assertEqual(vampyre.hit_points, 0)
     self.assertEqual(vampyre.lives, 0)
コード例 #4
0
 def test_vampyre_take_damage_2(self):
     vampyre = Vampyre('Drakula')  # hit_points=12, lives=3
     vampyre.take_damage(24)
     self.assertEqual(vampyre.hit_points, 12)
     self.assertEqual(vampyre.lives, 1)
コード例 #5
0
troll2.take_damage(1)
print(troll2)

# troll2.take_damage(4)
# print(troll2)

print('------------------------')

# Creating Vampyre instances
vam1 = Vampyre('vam1')
print(vam1)

vam2 = Vampyre('vam2')
print(vam2)

vam1.take_damage(5)
print(vam1)

vam1.take_damage(8)
print(vam1)

vam3 = Vampyre('vam3')
print(vam3)

while vam3._alive:
    vam3.take_damage(1)
    print(vam3)

print('---------Vampyre King---------')
dracula = VampyreKing('Dracula')
print(dracula)
コード例 #6
0
ファイル: main.py プロジェクト: hippensteele/python-course
from enemy import Enemy, Troll, Vampyre, VampyreKing

#random_monster = Enemy("Basic enemy", 12, 1)
#print(random_monster)
#random_monster.take_damage(4)
#print(random_monster)
#random_monster.take_damage(8)
#print(random_monster)
#random_monster.take_damage(9)
#print(random_monster)

#ugly_troll = Troll()
#print("Ugly troll - {}".format(ugly_troll))
#
#another_troll = Troll("ug", 18, 1)
#print("Another troll - {}".format(another_troll))
#
#brother = Troll("Urg", 23)
#print(brother)
#brother.grunt()
#brother.take_damage(5)

vamp = Vampyre("Vlad")
while vamp.alive:
    vamp.take_damage(1)
#    print(vamp)

vampTheGreat = VampyreKing("Big Vlad")
while vampTheGreat.alive:
    vampTheGreat.take_damage(8)
コード例 #7
0
another_troll = Troll("Ug")
print("Another troll - {}".format(another_troll))

brother = Troll("Urg")
print(brother)
brother.take_damage(18)
print(brother)

ugly_troll.grunt()
another_troll.grunt()
brother.grunt()

dracula = Vampyre("Dracula")
print(dracula)
dracula.take_damage(4)
print(dracula)

print("-" * 40)
another_troll.take_damage(30)
print(another_troll)

while dracula._alive:
    dracula.take_damage(1)
    #print(dracula)

vlad = VampyreKing("Vlad")
print(vlad)

while vlad._alive:
    vlad.take_damage(4)
コード例 #8
0
another_troll = Troll("Ug")
print("Another troll - {}".format(another_troll))

brother = Troll("Urg")
print(brother)
brother.take_damage(3)

ugly_troll.grunt()
another_troll.grunt()
brother.grunt()

vamp = Vampyre("Poo")
print("new_vampyre - {}".format(vamp))

vamp.take_damage(4)
print(vamp)

another_vamp = Vampyre("Akash")
print("another_vamp - {}".format(another_vamp))
another_vamp.take_damage(3)

print("*" * 40)

another_troll.take_damage(35)
print(another_troll)

vamp._live = 0
vamp._hit_points = 1
print(vamp)
コード例 #9
0
ファイル: main.py プロジェクト: TsvetanIlchev/Python
from enemy import Troll, Vampyre

ugly_troll = Troll("Pug")
print("Ugly troll - {}".format(ugly_troll))

another_troll = Troll("Ug")
print("Another troll - {}".format(another_troll))
another_troll.take_damage(18)
print(another_troll)

brother = Troll("Urg")
print(brother)

ugly_troll.grunt()
another_troll.grunt()
brother.grunt()

vampyre = Vampyre("Vlad")
print(vampyre)
vampyre.take_damage(5)
print(vampyre)
コード例 #10
0
print('ugly troll - {}'.format(ugly_troll))

another_troll = Troll('Ug')
print('Another troll - {}'.format(another_troll))
another_troll.take_damage(18)

brother = Troll('Urg')
print(brother)

ugly_troll.grunt()
another_troll.grunt()
brother.grunt()

vamp = Vampyre("Vlad")
print(vamp)
vamp.take_damage(5)
print(vamp)

print('-' * 40)
another_troll.take_damage(30)
print(another_troll)

# while vamp.alive:
# 	vamp.take_damage(1)
#print(vamp)
print('-' * 40)
dracula = VampyreKing('Dracula')
print(dracula)
dracula.take_damage(12)
print(dracula)
コード例 #11
0
ファイル: main.py プロジェクト: milandesai47/python-demo
ugly_troll = Troll("pug")
print("ugly_troll- {}".format(ugly_troll))

another_troll = Troll("ur")
print(another_troll)
another_troll.take_damage(18)
print(another_troll)

brother = Troll("urg")
print(brother)

ugly_troll.grunt()
another_troll.grunt()
brother.grunt()

Vamp = Vampyre("vlad")
print(Vamp)
Vamp.take_damage(5)
print(Vamp)

print("*" * 40)
another_troll.take_damage(30)
print(another_troll)

# while Vamp.alive:
#     Vamp.take_damage(1)

Vamp._lives = 0
Vamp._hit_points = 1
print(Vamp)
コード例 #12
0
from enemy import Enemy, Troll, Vampyre, VampyreKing

# random_monster = Enemy("Basic_Enemy", 12, 1)
# print(random_monster)
# random_monster.take_damage(4)
# print(random_monster)

ugly_troll = Troll("pug")
print("ugly troll : {0}".format(ugly_troll))

another_troll = Troll("Ug", 3)
print("another_troll : {0}".format(another_troll))

brother = Troll("Urg")
print(brother)

ugly_troll.grunt()
brother.grunt()

vamp1 = Vampyre("vamp1")
print(vamp1)

print("*" * 40)
while vamp1.alive:
    vamp1.take_damage(5)
    print(vamp1)

vampK = VampyreKing('suresh')
print(vampK)
vampK.take_damage(10)
print(vampK)
コード例 #13
0
# brother = Troll("Urg", 23)
brother = Troll("Urg")
print(brother)

print()
ugly_troll.grunt()
another_troll.grunt()
brother.grunt()
print()

# Vampyre insert ########
vamp = Vampyre("Vamp")
print("My name is {0.name}. Welcome!".format(vamp))
print(vamp)
vamp.take_damage(10)
print(vamp)

print("-" * 40)
another_troll.take_damage(30)
print(another_troll)
vamp.take_damage(20)
print(vamp)

while vamp.alive:
    vamp.take_damage(4)
    print(vamp)

# Vampyre King insert ######
print("-" * 40)
dracula = VampyreKing("The Vlad")
コード例 #14
0
from enemy import Troll, Vampyre, VampyreKing
from player import Player

a = 3
b = "tim"
c = 1, 2, 3

print(a)
print(b)
print(c)
p1 = Player("Peter")
print(p1)

t1 = Troll("To")
t1.take_damage(5)
print(t1)

v1 = Vampyre("Vlad")
print(v1)
v1.take_damage(3)
print(v1)

v2 = VampyreKing("Dave")
print(v2)
v2.take_damage(16)
print(v2)
コード例 #15
0
Also make sure that the trolls can also take damage, because we haven't tested that yet.
"""
from enemy import Troll, Vampyre

ugly_troll = Troll("Pug")
print("Ugly troll - {}".format(ugly_troll))

another_troll = Troll("Ug")
print("Another troll - {}".format(another_troll))
another_troll.take_damage(18)
print(another_troll)

brother = Troll("Urg")
print(brother)

ugly_troll.grunt()
another_troll.grunt()
brother.grunt()

dracula = Vampyre("Dracula")
amber = Vampyre("Amber")

print(dracula)
dracula.take_damage(10)
print(dracula)

print(amber)
amber.take_damage(7)
print(amber)