Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

Commit

Permalink
VIETNAM
Browse files Browse the repository at this point in the history
  • Loading branch information
YogurtTheHorse committed Sep 28, 2016
1 parent d07d096 commit 47001f5
Show file tree
Hide file tree
Showing 120 changed files with 218 additions and 114 deletions.
2 changes: 1 addition & 1 deletion items/loot/ak.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = 'АК-47'
description = (
' Пробивает рельс. Насвозь. Вдоль. Наверное.'
' Пробивает рельс. Насвозь. Вдоль. Наверное.'
)

price = 300
Expand Down
2 changes: 1 addition & 1 deletion items/loot/m-16.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = 'М-16'
description = (
'Приклад немного подплавился и треснул. _Держать вдали от воды!_'
'Приклад немного подплавился и треснул. _Держать вдали от воды!_'
)

price = 300
Expand Down
2 changes: 1 addition & 1 deletion items/loot/m79.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = 'M79'
description = (
'Уничтожает. Быстро.'
'Уничтожает. Быстро.'
)

price = 800
Expand Down
2 changes: 1 addition & 1 deletion items/loot/minigun.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = 'Миниган'
description = (
'Тратит твои патроны. Быстро.'
'Тратит твои патроны. Быстро.'
)

price = 650
Expand Down
13 changes: 13 additions & 0 deletions items/loot/vietnam_star.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name = 'Мазь "Звёздочка"'
description = 'Лечебная мазь универсального действия. Кажется, может вылечить даже от рака.'
price = 300

usable = True
disposable = True

def on_use(user, reply):
reply('Вот так-то лучше!')

user.heal(25)

user.buffs = [ b for b in user.buffs if not b.is_negative() ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions rooms/special/sign.py → rooms/default/special/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_actions(user):
actions = [ ]

for room_type, room_name in rooms:
loaded_room = roomloader.load_room(room_name, room_type)
loaded_room = roomloader.load_room(room_name, room_type, user)
name = loaded_room.name
if room_name not in all_visited_rooms:
name = crypt(name)
Expand All @@ -34,7 +34,7 @@ def enter(user, reply):

while len(rooms) < 4:
rm = roomloader.get_next_room(user)
loaded_room = roomloader.load_room(rm[1], rm[0])
loaded_room = roomloader.load_room(rm[1], rm[0], user)

if random.random() < 0.05:
rm = ('special', 'rick_astley')
Expand All @@ -47,7 +47,7 @@ def enter(user, reply):
def action(user, reply, text):
rooms = user.get_room_temp('rooms')
for room_type, room_name in rooms:
loaded_room = roomloader.load_room(room_name, room_type)
loaded_room = roomloader.load_room(room_name, room_type, user)
if loaded_room.name == text or crypt(loaded_room.name) == text:
if random.random() < 0.1:
reply('Что-то пошло не так, ты увидел фезку пролетающую у тебя над головой. Ощущения будто был нарушен межпространственный континуум.')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def action(user, reply, text):
'И видит..\n'
)

room = roomloader.load_room(found_user.room[1], found_user.room[0])
room = roomloader.load_room(found_user.room[1], found_user.room[0], found_user)
room_name = room.name

res += room_name
Expand All @@ -66,7 +66,7 @@ def action(user, reply, text):
'И бросает кости в..\n'
)

room = roomloader.load_room(found_user.room[1], found_user.room[0])
room = roomloader.load_room(found_user.room[1], found_user.room[0], found_user)
room_name = room.name

res += room_name
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
49 changes: 49 additions & 0 deletions rooms/default/usual/river.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name = 'Река'


def get_actions(user):
return [ 'Грести', 'Вернуться в коридор' ]


def enter(user, reply):
reply(
'Дверь, через которую ты вошел, магическим образом исчезла.\n'
'Ты решаете осмотреться и замечаещь лодку, стоящую неподалёку.\n'
'Тебе ничего не остается, кроме как прыгнуть в речку и плыть. Да, всё именно так.\n'
'Хотя можно просто вернуться обратно в Джунгли..'
)
user.set_room_temp('rvr', 0)

def action(user, reply, text):
if text == 'Вернуться в коридор':
user.leave(reply)
return

rvr = user.get_room_temp('rvr', 0)

if user.has_item('m79') :
rvr += 4
reply('Ты вспоминаешь, что у тебя есть М79, берешь его в руки и гребешь.')
else:
rvr += 1
reply('Ты гребешь руками. Кажется, что скоро конец')

user.set_room_temp('rvr', rvr)

if rvr > 8:
msg = ''
if user.has_item('m-16'):
user.remove_item('m-16')
reply('Твой М-16 теперь не стреляет.. пришлость выкинуть.')


reply(
'Вы пристаете к другому концу берега, вылезаете из лодки.\n'
'Единственное место, куда вы можете пойти здесь - едва приоткрытая дверь.\n'
'Вы открываете дверь... И выходите во *Вьетнам*!\n\n'
'_Приключения начинаются_.\n\n'
'..._снова_.'
)

user.rooms_pack = 'vietnam'
user.leave(reply)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 0 additions & 11 deletions rooms/monster/vietnam/bush_soldier.py

This file was deleted.

64 changes: 0 additions & 64 deletions rooms/monster/vietnam/river.py

This file was deleted.

34 changes: 19 additions & 15 deletions rooms/roomloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
logger = logging.getLogger('rg')

def load_room(name, room_type='usual', user=None):
path = 'rooms/{0}/{1}.py'.format(room_type, name)
path = 'rooms/{0}/{1}/{2}.py'.format(user.rooms_pack if user is not None else 'default', room_type, name)

if not os.path.exists(path):
path += 'c'
Expand Down Expand Up @@ -275,12 +275,13 @@ def get_next_room(user):
if p < 1 / 100:
return ('special', 'remains')
elif p <= 0.7:
return get_random_room('monster/' + user.level, user)
return get_random_room('monster/' + user.level, user, 'monster')
else:
return get_random_room('usual', user)

def get_all_rooms(room_type):
pth = 'rooms/' + room_type + '/'
def get_all_rooms(rooms_pack, room_type):
pth = 'rooms/' + rooms_pack + '/' + room_type + '/'

rooms = [ f[:-3] for f in os.listdir(pth) if f.endswith('.py') ]
comp_rooms = [ f[:-4] for f in os.listdir(pth) if f.endswith('.pyc') ]

Expand All @@ -291,7 +292,7 @@ def get_level_rooms(user, level):
names = [ ]
rm_type = 'monster/' + str(level)

for rm in get_all_rooms(rm_type):
for rm in get_all_rooms(user.rooms_pack, rm_type):
if rm in all_visited_rooms:
room = load_room(rm, rm_type, user)
names.append(room.name)
Expand All @@ -300,33 +301,36 @@ def get_level_rooms(user, level):

return names

def get_random_room(room_type, user):
rooms = get_all_rooms(room_type)
def get_random_room(room_type, user, second_type=None):
rooms = [ (room_type, rm) for rm in get_all_rooms(user.rooms_pack, room_type) ]

if second_type is not None:
rooms.extend([ (second_type, rm) for rm in get_all_rooms(user.rooms_pack, second_type) ])

all_visited_rooms = user.get_perma_variable('visited_rooms', [ ])

not_visited_rooms = [ ]
visited_rooms = [ ]

for rm in rooms:
for tp, rm in rooms:
if rm in all_visited_rooms:
visited_rooms.append(rm)
visited_rooms.append((tp, rm))
else:
not_visited_rooms.append(rm)
not_visited_rooms.append((tp, rm))

visited_rooms_proc = len(visited_rooms) / len(rooms)

if visited_rooms_proc < 1:
visit_new_p = 1 - visited_rooms_proc / 5

name = ''
new_room = ''

if random.random() < visit_new_p:
name = random.choice(not_visited_rooms)
new_room = random.choice(not_visited_rooms)
else:
name = random.choice(visited_rooms)
new_room = random.choice(visited_rooms)
else:
user.prepare_boss()
name = random.choice(rooms)
new_room = random.choice(rooms)

return (room_type, name)
return new_room
11 changes: 11 additions & 0 deletions rooms/vietnam/monster/bush_soldier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name = 'Куст'
hp = 280
damage_range = (20, 35)

coins = 200

loot = [ 'm-16' ]

def enter(user, reply):
reply('Когда ты проходил мимо куста, из него выпрыгнул солдат и ударил тебя прикладом')
user.make_damage(0, 30, reply, name='Приклад')
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

coins = 27

loot = [ 'grass_in_pot' ]
loot = [ 'vietnam_star' ]

def enter(user, reply):
reply('Он против войны. Докажи ему, что он не прав.')
16 changes: 16 additions & 0 deletions rooms/vietnam/monster/vietnam_army.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import random

name = 'Армия Вьетнамцев'

hp = 1500
damage_range = ( 40, 70 )

coins = 1337

loot = [random.choice([ 'ak', 'm79' ])]

def enter(user, reply):
msg = (
'Огромая куча вьетнамцев, на летающих тракторах производства СССР, устроит дискотеку с фейерверком и светомузыкой. '
)
reply(msg)
46 changes: 46 additions & 0 deletions rooms/vietnam/usual/river.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name = 'Река'


def get_actions(user):
return [ 'Грести', 'Вернуться в джунгли' ]


def enter(user, reply):
reply(
'Ты решаете осмотреться и замечаещь лодку, стоящую неподалёку.\n'
'Тебе ничего не остается, кроме как прыгнуть в речку и плыть. Да, всё именно так.\n'
'Хотя можно просто вернуться обратно в Джунгли..'
)
user.set_room_temp('rvr', 0)

def action(user, reply, text):
if text == 'Вернуться в джунгли':
user.leave(reply)
return

rvr = user.get_room_temp('rvr', 0)

if user.has_item('m79') :
rvr += 4
reply('Ты вспоминаешь, что у тебя есть М79, берешь его в руки и гребешь.')
else:
rvr += 1
reply('Ты гребешь руками. Кажется, что скоро конец')

user.set_room_temp('rvr', rvr)

if rvr > 8:
msg = ''
if user.has_item('m-16'):
user.remove_item('m-16')
reply('Твой М-16 теперь не стреляет.. Пишлость выкинуть.')


reply(
'Вы пристаете к другому концу берега, вылезаете из лодки.\n'
'Единственное место, куда вы можете пойти здесь - едва приоткрытая дверь.\n'
'Вы открываете дверь... И выходите в Коридор!\n\n'
)

user.rooms_pack = 'default'
user.leave(reply)
Loading

0 comments on commit 47001f5

Please sign in to comment.