コード例 #1
0
# Create some items
potion = Item("Potion", "potion", "Heals for 50 HP", 50)
hipotion = Item("Hi-potion", "potion", "Heals for 100 HP", 100)
superpotion = Item("Super potion", "potion", "Heals for 500 HP", 500)
elixer = Item("Elixer", "elixer", "Fully restores HP/MP of one party member",
              9999)
hielixer = Item("MegaElixer", "elixer", "Fully restores party's HP/MP", 9999)

grenade = Item("Grenade", "attack", "Deals 500 damage", 500)

player_spells = [fire, thunder, blizzard, meteor, quake, cure, cura]
player_items = [potion, hipotion, superpotion, elixer, hielixer, grenade]

#instatiate people
player = Person(460, 65, 60, 34, player_spells, player_items)
enemy = Person(1200, 65, 45, 25, [], [])

running = True

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS!" + bcolors.END)

while running:
    print("===========================")
    player.choose_action()
    choice = input("Choose action: ")
    index = int(choice) - 1

    if index == 0:
        dmg = player.generate_damage()
        enemy.take_damage(dmg)
コード例 #2
0
grenade = Item("Grenade", "attack", "Deals 500 damage", 500)

#Instantiate People
#Players
player_magics = [fire, thunder, blizzard, meteor, cure, cure_max]

player_items = [
    {"item": potion, "quantity": 10}, 
    {"item": high_potion, "quantity": 5}, 
    {"item": super_potion, "quantity": 1},
    {"item": elixir, "quantity": 3},
    {"item": high_elixir, "quantity": 1},
    {"item": grenade, "quantity": 1}
]

player1 = Person("Tenshi", 4670, 140, 80, 35, player_magics, player_items)
player2 = Person("Bibi", 4320, 120, 60, 35, player_magics, player_items)
player3 = Person("Mimikyute", 4830, 170, 95, 35, player_magics, player_items)

players = [player1, player2, player3]

#Enemies
enemy_magics = [fire, meteor, cure_ultra]

enemy1 = Person("Bobokoblin 1", 1200, 130, 600, 325, enemy_magics, [])
enemy2 = Person("Final boss' boss", 20000, 350, 450, 50, enemy_magics, [])
enemy3 = Person("Bobokoblin 2", 1200, 130, 600, 325, enemy_magics, [])

enemies = [enemy1, enemy2, enemy3]

#Start code
コード例 #3
0
potion = Item("Potion", "potion", "Heals 50 HP", 50)
greatpotion = Item("GreatPotion", "potion", "Heals 100 HP", 100)

# Create items - damage

molotov = Item("Cocktail Molotov", "bomb", "deals 500 damage", 500)

# Instantiate Player and enemy

player_spells = [fire, chaos_bolt, necromant, corruption, cure, renew]
player_items = [{"item": potion, "quantity": 5},
                {"item": greatpotion, "quantity": 3},
                {"item": molotov, "quantity": 2}]


player = Person(500, 200, 45, 35, player_spells, player_items )

enemy = Person(1200, 65, 45, 25, [], [])

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS" + bcolors.ENDC)

while running:
    print("=========================")
    player.choose_action()
    choice = input("Choose action: ")
    index = int(choice) - 1

    if index == 0:
コード例 #4
0
player_items = [{
    "item": potion,
    "quantity": 15
}, {
    "item": hpotion,
    "quantity": 5
}, {
    "item": elixer,
    "quantity": 5
}, {
    "item": grenade,
    "quantity": 5
}]

#Instantiate People
player1 = Person("Naruto:", 4260, 132, 400, 34, player_spell, player_items)
player2 = Person("Sasuke:", 4160, 163, 400, 34, player_spell, player_items)
player3 = Person("Sakura:", 4060, 174, 500, 34, player_spell, player_items)

enemy1 = Person("Obito   ", 1500, 130, 560, 325, enemy_spell, [])
enemy2 = Person("Madara", 11200, 700, 520, 25, enemy_spell, [])
enemy3 = Person("Nagato  ", 1250, 130, 560, 325, enemy_spell, [])

players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS" + bcolors.ENDC)
コード例 #5
0
ファイル: main.py プロジェクト: sinasen2000/Enigmania
player_items = [{
    "item": potion,
    "quantity": 5
}, {
    "item": super_potion,
    "quantity": 5
}, {
    "item": elixir,
    "quantity": 5
}, {
    "item": shotgun,
    "quantity": 5
}]

enemy_magics = [stun, meteor, hypnosis, super_punch, element_bending]
player1 = Person("Manu :", 9000, 1000, 200, 30, player_magics, player_items)
player2 = Person("Zion :", 7000, 1000, 400, 30, player_magics, player_items)
player3 = Person("Jano :", 1000, 1000, 300, 30, player_magics, player_items)
enemy = Person("Ehmo :", 25000, 4800, 600, 50, enemy_magics, [])

players = [player1, player2, player3]

res = True
i = 0

print(colors.failure + colors.bold + "Welcome to the fight!" + colors.end)

while res:
    print("======================")

    for player in players:
コード例 #6
0
ファイル: main.py プロジェクト: Lion-Ga92/Journey_fight3
)
print(
    "Keep an eye on the hints, which will affect the story as you go along. You may be attacked at random."
)
print(
    "When you enter a battle, you will be given three choices either 'fight', 'heal', 'rum'"
)
print(
    "When you are in battle mode, you will not be able to exit the script. Only when making decisions will you be "
)
print(
    "able to type 'quit' as an input and exit the script. Play out the battle before attempting to quit."
)
input("Press enter to continue")

player = Person(400, 40, 10, 10, 10)
enemy = Person(400, 40, 10, 5, 10)
enemy2 = Person(400, 50, 10, 5, 10)
Bear = Creature(100, 40)


def start_journey():
    print(
        """You are walking down a forest, in the realms of Gaul. You are on the way to the Feast of Augustus,
          As you approach a fork in the road, you noticed there is no signage. You pause to think, and see both 
          roads. The left most road seems to be wide and appealing, it seems to be the main road. But you hesitate 
          to take it as robbers and pillagers tend to stake them out. The right road seem harder to walk through, 
          the terrain in rough. And the trees are less wide apart than the right path. But you hope that as the less
          busy one robbers will be less of a concern.""")
    input("press enter to continue")
    start_choice = input(
コード例 #7
0
grenade = Item("Grenade", "attack", "Deals 500 damage", 500)


#
#
#       {"name": "Thunder", "Cost": 10, "dmg": 60},
#        {"name": "Blizzard", "Cost": 10, "dmg": 60}]

player_spells = [fire, thunder, meteor, cure, cura]
player_items = [{"item": potion, "quantity": 15}, {"item": hipotion, "quantity": 5},
                {"item": superpotion, "quantity": 5}, {"item": elixer, "quantity": 5},
                {"item": hielixer, "quantity": 5}, {"item": grenade, "quantity": 5}]


#instantiate People
player1 = Person("Valos", 460, 65, 60, 34, player_spells, player_items)
player2 = Person("Nick", 460, 65, 60, 34, player_spells, player_items)
player3 = Person("Robot", 460, 65, 60, 34, player_spells, player_items)
enemy1 = Person("Magus", 1200, 65, 45, 25, [], [])

players = [player1,player2, player3]
enemies = [enemy1]

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS" + bcolors.ENDC)

while running:
    print("====================")
コード例 #8
0
ファイル: main.py プロジェクト: diegohenderson/Battle-RPG
# white magic
cure = Spell("Cure", 12, 120, "white")
cura = Spell("Cura", 18, 200, "white")

#items
potion = Item("Potion", "potion", "Heals 50 HP", 50)
hipotion = Item("Hi.Potion", "potion", "Heals 100 HP", 100)
superpotion = Item("Super Potion", "potion", "Heals 500 HP", 500)
elixer = Item("Elixer", "elixer", "Fully restores HP/MP", 999)
hielixer = Item("MegaElixer", "elixer ", "restores", 9988)

granade = Item("Granade", "attack", " deals 500 dmg", 500)
player_spells = [fire, thunder, blizzard, meteor, quake, cure, cura]
player_items = [potion, hipotion, superpotion, elixer, hielixer]
#instantiate people
player = Person(460, 65, 60, 34, player_spells, player_items)
enemy = Person(1200, 65, 45, 25, [], [])
running = True
i = 0
print(Bcolors.FAIL + Bcolors.BOLD + "AN ENEMY Attacks" + Bcolors.ENDC)
while running:
    print("----------")
    player.choose_action()
    choice = input("choose action:")
    index = int(choice) - 1

    if index == 0:
        dmg = player.generate_damage()
        enemy.take_damage(dmg)
        print("you attacked for ", dmg, "points of damage")
    elif index == 1:
コード例 #9
0
ファイル: main.py プロジェクト: Avichal-Suneja/RPG-Battle
potion       = items("Potion", "potion", "Heals 50 HP", 50)
mega_potion  = items("Mega Potion", "potion", "Heals 100 HP", 100)
super_potion = items("Super Potion", "potion", "Heals 500 HP", 500)
elixir       = items("Elixir", "elixir", "Restores full HP/MP of one party member", 9999)
mega_elixir  = items("Mega Elixir", "mega_elixir", "Restores full HP/MP of all party members", 9999)
grenade      = items("Grenade", "attack", "Deals a damage of 500 HP", 500)

# Creating arrays of spells and items
player_spells = [fire, thunder, quake, meteor, cure, cura]
player_items  = [{"item": potion, "qty":15}, {"item": mega_potion, "qty":5},
                {"item": super_potion, "qty":3}, {"item": elixir, "qty":3},
                {"item": mega_elixir, "qty":1},{"item": grenade, "qty":1}]


# initialising players:
player1 = Person("Avichal:", 500, 45, 60, 34, player_spells, player_items)
player2 = Person("Nick   :", 500, 45, 60, 34, player_spells, player_items)
player3 = Person("Robot  :", 500, 45, 60, 34, player_spells, player_items)
# initialising enemies:
enemy1  = Person("Imp    :", 300, 40, 50, 20,player_spells,player_items) 
enemy2  = Person("Villain:", 1200, 100, 120, 10, player_spells,player_items)
enemy3  = Person("Imp    :", 300, 20, 50, 20,player_spells,player_items)
enemies = [enemy1, enemy2, enemy3]
players = [player1, player2, player3]
print("\n\n")

# Header and set loop to true
print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS" + bcolors.ENDC)
running = True

while running:
コード例 #10
0
def init_characters():
    player1 = Person("Valos", 20, 40, 250, spells, items)
    player2 = Person("Nick ", 20, 145, 200, spells, items)
    player3 = Person("Robot", 20, 150, 160, spells, items)
    enemy1 = Person("Imp  ", 20, 50, 200, enemy_spells, [])
    enemy2 = Person("Grogr", 20, 60, 500, enemy_spells, [])
    enemy3 = Person("Imp  ", 20, 30, 200, enemy_spells, [])

    player1.items = [{
        "item": items[0],
        "quantity": 5
    }, {
        "item": items[1],
        "quantity": 5
    }, {
        "item": items[2],
        "quantity": 5
    }, {
        "item": items[3],
        "quantity": 5
    }, {
        "item": items[4],
        "quantity": 2
    }, {
        "item": items[5],
        "quantity": 5
    }]
    player2.items = [{
        "item": items[0],
        "quantity": 5
    }, {
        "item": items[1],
        "quantity": 5
    }, {
        "item": items[2],
        "quantity": 5
    }, {
        "item": items[3],
        "quantity": 5
    }, {
        "item": items[4],
        "quantity": 2
    }, {
        "item": items[5],
        "quantity": 5
    }]
    player3.items = [{
        "item": items[0],
        "quantity": 5
    }, {
        "item": items[1],
        "quantity": 5
    }, {
        "item": items[2],
        "quantity": 5
    }, {
        "item": items[3],
        "quantity": 5
    }, {
        "item": items[4],
        "quantity": 2
    }, {
        "item": items[5],
        "quantity": 5
    }]

    players = [player1, player2, player3]
    enemies = [enemy1, enemy2, enemy3]
    return players, enemies
コード例 #11
0
ファイル: main.py プロジェクト: saumya-singh/Battle
    "item": superpotion,
    "quantity": 5
}, {
    "item": elixer,
    "quantity": 5
}, {
    "item": hielixer,
    "quantity": 2
}, {
    "item": grenade,
    "quantity": 2
}]
enemy_spells = [fire, thunder, blizzard, meteor, cura, curaga]

# Instantiate People
player1 = Person("Kunkka:", 3460, 665, 390, 134, player_spells, player_items)
player2 = Person("Rexxar:", 3260, 565, 360, 134, player_spells, player_items)
player3 = Person("Riki  :", 3860, 510, 460, 134, player_spells, player_items)
enemy1 = Person("Lich  :", 12230, 865, 345, 25, enemy_spells, [])
enemy2 = Person("Goblin:", 1230, 365, 345, 25, enemy_spells, [])
enemy3 = Person("Orc   :", 1230, 365, 345, 25, enemy_spells, [])

players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS!" + bcolors.ENDC)

while running:
コード例 #12
0
ファイル: main.py プロジェクト: amitmoy/python
from Classes.game import Person, BColors, Stone
from Classes.Inventory import Tool, Item
'''tools = [{"name": "Stone Pickaxe", "cost": 5, "damage": 20,
          "efficiency": 0.1, "durability": 100, "maxDurability": 100},
         {"name": "Bronze Pickaxe", "cost": 10, "damage": 50,
          "efficiency": 0.3, "durability": 50, "maxDurability": 50},
         {"name": "Diamond Pickaxe", "cost": 20, "damage": 120,
          "efficiency": 0.7, "durability": 20, "maxDurability": 20}]'''

tools = [
    Tool("Stone Pickaxe", 50, 20, 100, 5, 1),
    Tool("Iron Pickaxe", 100, 50, 80, 10, 3),
    Tool("Diamond Pickaxe", 300, 100, 50, 20, 10)
]

player = Person(0, [], 1000, tools)
rock = Stone(1000)
'''
player.show_actions()
print("damage:", player.use_tool(1))
player.show_actions()
print("damage:", player.use_tool(1))
player.show_actions()
print("damage:", player.use_tool(1))
player.show_actions()
'''

while True:
    player.show_actions()
    playerInput = input(BColors.OKBLUE + BColors.UNDERLINE + "Choose Tool:" +
                        BColors.ENDC)
コード例 #13
0
from Classes.magic import Spell
import random
# Create Black Magic
fire = Spell("Fire",10,60,"black")
thunder = Spell("Thunder",15,120,"black")
quake = Spell("Quake",25,230,"black")

#Create healing magic
cure= Spell ("Cure",12,120,"white")
love= Spell ("Love",20,240,"white")

#all the magic in one place
magic=[fire,thunder,quake,cure,love]


player = Person(500,65,30,magic)
enemy = Person(500,65,30,magic)


running =True 
i=0
##PLAYER CHOICE FOR ATTACK##
print(colored("ATTACK", "red"))
while running:
    print("*************************************")
    #Allowing player to choose between attack and magic 
    player.choose_action()
    #minus 1 as indexing starts from 0
    choice=int(input("Choose action:"))-1
    print("You choose {}".format(player.actions[int(choice)]))
    
コード例 #14
0
ファイル: main.py プロジェクト: dnlolski/PyTextRPG
    "quantity": 2
}, {
    "item": elixir,
    "quantity": 2
}, {
    "item": megaElixir,
    "quantity": 1
}, {
    "item": scrollOfFire,
    "quantity": 5
}]

enemy_spells = [fire, meteor, cure]
enemy_items = []

player1 = Person("Yubei    ", 3260, 132, 300, 34, player_spells, player_items)
player2 = Person("Hiridrim ", 4160, 188, 311, 34, player_spells, player_items)
player3 = Person("Jaina    ", 3089, 174, 288, 34, player_spells, player_items)

enemy = Person("BIG BOSS ", 11200, 2210, 525, 25, enemy_spells, enemy_items)
enemy2 = Person("Imp      ", 1250, 130, 560, 325, enemy_spells, enemy_items)
enemy3 = Person("Imp      ", 1250, 130, 560, 325, enemy_spells, enemy_items)

players = [player1, player2, player3]
enemies = [enemy, enemy2, enemy3]

running = True

print(Bcolors.FAIL + Bcolors.BOLD + enemy.name + " ATTACKS!" + Bcolors.ENDC)
print("Enemy HP: ", enemy.get_max_hp())
コード例 #15
0
ファイル: Main.py プロジェクト: FreezyAG/Fighting-Game
hipotion = Item('Hi-Potion', 'potion', 'Heals 100 HP', 100)
superpotion = Item('Super-Potion', 'potion', 'Heals 500 HP', 500)
elixer = Item('Elixer', 'elixer', 'Fully restores HP/MP of one party member', 9990)
hielixer = Item('Megaelixer', 'elixer', "Fully restores party's HP/MP", 9990)

grenade = Item('Grenade', 'attack', 'Deals 300 damage', 300)

player_spells = [fire, thunder, meteor, blizzard, quake,  cure, cura]
enemy_spells = [fire, meteor, cure]
player_item = [{'item': potion, 'quantity': 15}, {'item': hipotion, 'quantity': 5},
               {'item': superpotion, 'quantity': 5}, {'item': elixer, 'quantity': 5},
               {'item': hielixer, 'quantity': 5}, {'item': potion, 'quantity': 2},
               {'item': grenade, 'quantity': 5}]

#Instatiate people
player1 = Person('Valos:', 9390, 125, 125, 34, player_spells, player_item)
player2 = Person('Nick :', 9480, 475, 150, 34, player_spells, player_item)
player3 = Person('Robot:', 8460, 485, 175, 34, player_spells, player_item)
enemy1 = Person ('Imp  ', 1200, 130, 560, 35, enemy_spells, [])
enemy2 = Person ('Magos', 1200, 765, 525, 25, enemy_spells, [])
enemy3 = Person ('Imp  ', 1200, 130, 560, 35, enemy_spells, [])

players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]


running = True
i=0

print(bcolors.FAIL + bcolors.BOLD+ "AN ENEMY ATTACKS!" + bcolors.ENDC)
コード例 #16
0
player_bag = [{
    "item": venom,
    "quantity": 2
}, {
    "item": spitterz,
    "quantity": 2
}, {
    "item": elixir,
    "quantity": 1
}]

# enemy inventory
enemy_bag = []

# instantiating the players
player = Person(100, 100, 40, 30, player_magic, player_bag)
enemy = Person(200, 200, 20, 50, enemy_magic, enemy_bag)

print(bgcolor.BOLD +
      "NAME              HP                                  MP" +
      bgcolor.ENDC)
print(bgcolor.BOLD + "SAM:       " + str(player.get_hp()) + "/" +
      str(player.get_max_hp()) + bgcolor.ENDC + bgcolor.OKLIGHTGREEN +
      "|█████████████████████████|" + bgcolor.ENDC + "  " + bgcolor.BOLD +
      str(player.get_mp()) + "/" + str(player.get_max_hp()) + bgcolor.OKBLUE +
      "|█████|" + bgcolor.ENDC)
print(bgcolor.BOLD + "NIKHIL:    " + str(player.get_hp()) + "/" +
      str(player.get_max_hp()) + bgcolor.ENDC + bgcolor.OKLIGHTGREEN +
      "|█████████████████████████|" + bgcolor.ENDC + "  " + bgcolor.BOLD +
      str(player.get_mp()) + "/" + str(player.get_max_hp()) + bgcolor.OKBLUE +
      "|█████|" + bgcolor.ENDC)
コード例 #17
0
    "quantity": 5
}, {
    "item": superpotion,
    "quantity": 5
}, {
    "item": elixer,
    "quantity": 5
}, {
    "item": megaelixer,
    "quantity": 2
}, {
    "item": grenade,
    "quantity": 5
}]

player1 = Person("Jonh:", 3500, 145, 250, 34, player_spells, player_Items)
player2 = Person("Ray:", 4100, 170, 300, 34, player_spells, player_Items)
player3 = Person("Marvis:", 5000, 190, 310, 34, player_spells, player_Items)

enemy1 = Person("Zayon", 4000, 130, 560, 325, enemy_spells, [])
enemy2 = Person("Thanos", 6000, 701, 525, 25, enemy_spells, [])
enemy3 = Person("Bruce Lee", 7500, 130, 560, 325, enemy_spells, [])

players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "THE BATTLE BEGINS!" + bcolors.ENDC)
コード例 #18
0
ファイル: main.py プロジェクト: br34th5/Python
    "quantity": 3
}, {
    "item": superpotion,
    "quantity": 3
}, {
    "item": elixer,
    "quantity": 1
}, {
    "item": hielixer,
    "quantity": 1
}, {
    "item": grenade,
    "quantity": 1
}]

player1 = Person("Valos  ", 3000, 100, 200, 30, player_spells, player_items)
player2 = Person("Einaras", 3100, 100, 200, 30, player_spells, player_items)
player3 = Person("Robot  ", 3200, 100, 200, 30, player_spells, player_items)

enemy1 = Person("Dog ", 1200, 130, 500, 200, enemy_spells, [])
enemy2 = Person("Lich", 12000, 400, 800, 25, enemy_spells, [])
enemy3 = Person("Elf ", 1200, 130, 800, 200, enemy_spells, [])

players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS!" + bcolors.ENDC)
コード例 #19
0
ファイル: main.py プロジェクト: Shafin580/Python-Projects
    "quantity": 3
}]

enemy_items = [{
    "item": superpotion,
    "quantity": 3
}, {
    "item": megapotion,
    "quantity": 1
}, {
    "item": granade,
    "quantity": 2
}]

# Instantiate people
player1 = Person("Shafin", 1460, 170, 60, 36, player_spells, player_items)
player2 = Person("Emran", 1460, 170, 60, 36, player_spells, player_items)
player3 = Person("Nobin", 1100, 100, 60, 36, player_spells, player_items)

players = [player1, player2, player3]

enemy1 = Person("Imp-01:", 900, 80, 300, 15, enemy_spells, enemy_items)
enemy2 = Person("Boss:", 1200, 200, 250, 35, enemy_spells, enemy_items)
enemy3 = Person("Imp-02:", 900, 80, 300, 15, enemy_spells, enemy_items)

enemies = [enemy1, enemy2, enemy3]

running = True

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS!" + bcolors.ENDC)
print("==========================")
コード例 #20
0
}, {
    "item": superpotion,
    "quantity": 5
}, {
    "item": elixir,
    "quantity": 5
}, {
    "item": megaelixir,
    "quantity": 5
}, {
    "item": grenade,
    "quantity": 5
}]

# Players instantiated with health points, magic points, attack points, defense power and magic spells
player1 = Person("Player 1", 3400, 150, 60, 34, player_spells, player_items)
player2 = Person("Player 2", 4000, 170, 60, 34, player_spells, player_items)
player3 = Person("Player 3", 3200, 120, 60, 34, player_spells, player_items)

players = [player1, player2, player3]

enemy1 = Person("CPU-1", 10000, 130, 560, 325, enemy_spells, [])
enemy2 = Person("CPU-2", 20000, 250, 450, 25, enemy_spells, [])
enemy3 = Person("CPU-3", 5000, 330, 450, 25, enemy_spells, [])

enemies = [enemy1, enemy2, enemy3]

defeated_enemies = 0
defeated_players = 0
running = True
i = 0
コード例 #21
0
spell_cura = Spell("Cura", 15, 250, "Life")

# Create items
item_potion = Item("Potion", "Potion", "Heals for 50 HP", 50)
item_hipotion = Item("Hi-Potion", "Potion", "Heals for 150 HP", 150)
item_superpotion = Item("Super-Potion", "Potion", "Heals for 250 HP", 250)
item_elixer = Item("Elixer", "Elixer", "Fully restores HP/MP of target", 0)
item_megaelixer = Item("Mega-Elixer", "Elixer", "Fully restores HP/MP of party", 0)
item_fraggrenade = Item("Frag Grenade", "Thrown Weapon", "Short fuse grenade", 150)
item_hegrenade = Item("HE Grenade", "Thrown Weapon", "High Explosive grenade", 500)

#Initialise characters
player_spells = [spell_cure, spell_fire, spell_blizzard]
player_items = [item_fraggrenade, item_potion, item_superpotion, item_elixer]

player = Person(460, 65, 60, 34, player_spells,player_items)
enemy = Person(1200, 65, 45, 25, [spell_cure, spell_thunder, spell_meteor],[item_hegrenade])

running = True

print("AN ENEMY ATTACKS!")

round_count = 1
while running:
    print("\n*********************************************************************************************************"
          "*\nRound #", round_count,"\n")

    # Choose action to take
    player.choose_action()
    choice = input("Choose action:")
コード例 #22
0
ファイル: main.py プロジェクト: mankusmi/Battle
}, {
    "item": superpotion,
    "quantity": 5
}, {
    "item": elixer,
    "quantity": 5
}, {
    "item": hielixer,
    "quantity": 2
}, {
    "item": grenade,
    "quantity": 5
}]

#Instantiate people
player1 = Person("Perkunas:", 3260, 132, 300, 34, player_spells, player_items)
player2 = Person("Gabija  :", 4160, 188, 311, 34, player_spells, player_items)
player3 = Person("Sarunas :", 3089, 174, 288, 34, player_spells, player_items)

enemy1 = Person("Imp  ", 1250, 130, 560, 325, enemy_spells, [])
enemy2 = Person("Magus", 11200, 701, 525, 25, enemy_spells, [])
enemy3 = Person("Imp  ", 1250, 130, 560, 325, enemy_spells, [])

players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS!" + bcolors.ENDC)
コード例 #23
0
ファイル: main.py プロジェクト: aalemi76/RPG-Battle-Project
cura = Spell("Cura", 100, 1500, "white")

#Creat Players' Items
potion = Item("Potion", "potion", "Heals 50 HP", 50, 15)
hipotion = Item("Hi Potion", "potion", "Heals 100 HP", 100, 5)
superpotion = Item("Super Potion", "potion", "Heals 500 HP", 100, 5)
elixir = Item("Elixir", "elixir", "Fully restores HP/MP of one party member",
              9999, 5)
megaelixir = Item("Mega Elixir", "elixir", "Fully restores party's HP/MP",
                  9999, 2)
grenade = Item("Grenade", "attack", "Deals 500 damage", 900, 5)

#Instantiate Players
player_spells = [fire, thunder, blizzard, meteor, quake, cure, cura]
player_items = [potion, hipotion, superpotion, elixir, megaelixir, grenade]
player1 = Person("Aegon", 3260, 332, 430, player_spells, player_items)
player2 = Person("Ario ", 4160, 408, 550, player_spells, player_items)
player3 = Person("Tony ", 3089, 474, 370, player_spells, player_items)
#Instantiate Enemies and their properties
#Note that Items are not usable for Enemies and they only use magic
firestorm = Spell("Fire Storm", 80, 900, "black")
meteorstorm = Spell("Meteor Storm", 100, 1800, "black")
ultimateelixir = Spell("Ultimate Storm", 50, 2000, "white")
enemy_spells = [firestorm, meteorstorm, ultimateelixir]
enemy1 = Person("Imp  ", 2500, 400, 560, enemy_spells, [])
enemy2 = Person("Robot", 15000, 800, 315, enemy_spells, [])
enemy3 = Person("Imp  ", 2500, 400, 560, enemy_spells, [])
#Set players
players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]
defeated_enemies = []
コード例 #24
0
hi_potion = Iteam("High Potion", "potion", "Heals 100 hp", 100)
super_potion = Iteam("Super potion", "potion", "Heals 200 hp", 200)
elixir = Iteam("Elixir", "elixir", "Fully restores HP/MP of one member", 9999)
hi_elixir = Iteam("High Elixir", "elixir", "Fully restores party's HP/Mp", 9999)

grenade = Iteam("Grenade", "attack", "Deals 500 damage", 500)


# Create List/Dictionary for Spells/Items
player_spells = [fire, thunder, meteor, blizzard, cure, cura]
enemy_spells = [fire, meteor, curaga]
player_items = [{"item": potion, "quantity": 15}, {"item": hi_potion, "quantity": 5}, {"item": super_potion, "quantity":5},
                {"item": elixir, "quantity": 5}, {"item": hi_elixir, "quantity": 2}, {"item": grenade, "quantity": 5}]

# Initialize People
player1 = Person("Valos:", 3260, 132, 300, 34, player_spells, player_items)
player2 = Person("Adam :", 4160, 188, 290, 34, player_spells, player_items)
player3 = Person("Eman :", 3089, 174, 288, 34, player_spells, player_items)

enemy2 = Person("Hench1  ", 1250, 130, 560, 325, enemy_spells, [])
enemy1 = Person("Margwa", 12000, 221, 500, 25, enemy_spells, [])
enemy3 = Person("Hench2  ", 1250, 130, 560, 325, enemy_spells, [])

players = [player1, player2, player3]
enemies = [enemy2, enemy1, enemy3]

# Alive
running = True
print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS!" + bcolors.ENDC)

while running:
コード例 #25
0
magic_potion = Item("Magic Potion", "potion", "Restore 200 MP", 200)
max_potion = Item("Max Potion", "elixir", "Fully restore  HP/MP", 999999)
mega_elixir = Item("Mega Elixir", "elixir", "Fully restore HP/MP for party's members", 999999)

dynamite = Item("Dynamite", "attack", "Hit for 200 HP enemy", 200)

player_spells = [fire, fireball, godFire, void, cure, hyperRestore]
enemy_spells = [meteor, end, cure]

player_items = [{"item": potion, "quantity": 5}, {"item": super_potion, "quantity": 2},
                {"item": mana_potion, "quantity": 5}, {"item": magic_potion, "quantity": 2},
                {"item": max_potion, "quantity": 1}, {"item": mega_elixir, "quantity": 1},
                {"item": dynamite, "quantity": 1}]

# Instantiate People
player1 = Person("MRX    ", 1500, 900, 20, 20, player_spells, player_items)
player2 = Person("Krypton", 2500, 200, 150, 20, player_spells, player_items)
player3 = Person("WhoAmI ", 3000, 150, 90, 20, player_spells, player_items)

enemy1 = Person("Draugr   ", 100, 150, 50, 26, enemy_spells, [])
enemy2 = Person("DeathLord", 999, 700, 150, 75, enemy_spells, [])
enemy3 = Person("Draugr   ", 100, 150, 50, 26, enemy_spells, [])

players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]

running = True
i = 0

print("\n")
print(bcolors.FAIL + bcolors.BOLD + "An Enemy Attacks!" + bcolors.ENDC)
コード例 #26
0
superpotion = Item("Super Potion", "potion", "Heals 1000 HP", 1000)
elixer = Item("Elixer", "elixer", "Fully restores HP/MP of one party member", 9999)
hielixer = Item("MegaElixer", "elixer", "Fully restores party's HP/MP", 9999)

grenade = Item("Grenade", "attack", "Deals 500 damage", 500)


player_spells = [fire, thunder, blizzard, meteor, cure, cura]
enemy_spells = [fire, meteor, curaga]
player_items = [{"item": potion, "quantity": 15}, {"item": hipotion, "quantity": 5},
                {"item": superpotion, "quantity": 5}, {"item": elixer, "quantity": 5},
                {"item": hielixer, "quantity": 2}, {"item": grenade, "quantity": 5}]


# Instantiate People
player1 = Person("Valos:", 3260, 132, 300, 34, player_spells, player_items)
player2 = Person("Nick :", 4160, 188, 311, 34, player_spells, player_items)
player3 = Person("Robot:", 3089, 174, 288, 34, player_spells, player_items)

enemy1 = Person("Imp  ", 1250, 130, 560, 325, enemy_spells, [])
enemy2 = Person("Magus", 18200, 701, 525, 25, enemy_spells, [])
enemy3 = Person("Imp  ", 1250, 130, 560, 325, enemy_spells, [])


players = [player1, player2, player3]
enemies = [enemy1, enemy2, enemy3]

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS!" + bcolors.ENDC)
コード例 #27
0
from Classes.game import Person, bcolors
from Classes.magic import Spell
import random
fire = Spell("Fire", 10, 100, "black")
thunder = Spell("Thunder", 12, 124, "black")
blizzard = Spell("Blizzard", 10, 100, "black")
meteor = Spell("meteor", 20, 200, "black")
quake = Spell("quake", 14, 140, "black")
cure = Spell("Cure", 12, 120, "white")
cura = Spell("Cura", 18, 200, "white")

player = Person(460, 65, 60, 34, [fire, thunder, blizzard, meteor, cure, cura])
enemy = Person(1200, 65, 45, 25, [fire, thunder, quake])

print(bcolors.FAIL + bcolors.BOLD + "An Enemy Attacks!" + bcolors.ENDC)
while player.get_hp() > 0:
    print("=============================")

    player.choose_action()
    choice = input("Your turn\nChoose action:")
    while (choice != '1') and (choice != '2'):
        choice = input("Choose valid action:")

    if choice is '1' and player.get_mp() <= 0:
        choice = '1'

    if choice is '1':
        print("You chose to attack")
        dmg = player.generate_dmg()
        enemy.take_dmg(dmg)
        print("You attacked for " + str(dmg) + " points of damage.   Enemy HP at " + str(enemy.get_hp()))