Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CM1101 Team Project
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Harry Wyatt
CM1101 Team Project
Commits
b9275c64
Commit
b9275c64
authored
2 years ago
by
Harry Wyatt
Browse files
Options
Downloads
Patches
Plain Diff
Updated some language and remoed the probabilities from code
parent
5467a8d9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
game.py
+2
-6
2 additions, 6 deletions
game.py
item_dist.py
+2
-0
2 additions, 0 deletions
item_dist.py
items.py
+14
-95
14 additions, 95 deletions
items.py
with
18 additions
and
101 deletions
game.py
+
2
−
6
View file @
b9275c64
...
...
@@ -332,8 +332,7 @@ def combat(enemy):
break
# now calculate the enemies attack
print
(
""
)
print
(
"
The
"
+
enemy
.
name
+
"
will now attack.
"
)
print
(
"
\n
The
"
+
enemy
.
name
+
"
will now attack.
"
)
enemy_attack_damage
,
critical
=
enemy
.
get_attack
()
damage_to_do
=
int
(
max
(
player
.
apply_defense
(
enemy_attack_damage
),
0
))
...
...
@@ -354,9 +353,6 @@ def combat(enemy):
else
:
print
(
"
Could not recognise that command.
"
)
def
puzzle
():
pass
def
boss_battle
():
game
=
MiniGame
(
game_map
,
game_info
,
random
.
randint
(
1
,
3
))
game
.
game_loop
()
...
...
@@ -409,7 +405,7 @@ def print_menu(exits, room_items, inv_items):
for
item
in
room_items
:
if
item
.
can_pickup
is
True
:
print
(
"
TAKE
"
,
item
.
id
.
upper
(),
"
to take a
"
,
item
.
name
+
"
.
"
)
print
(
"
TAKE
"
,
item
.
id
.
upper
(),
"
to take a
(n)
"
,
item
.
name
+
"
.
"
)
elif
item
.
on_interaction
is
not
None
:
# In this case, it's an item we must interact with in the game space as it cannot be picked up
print
(
f
"
INTERACT
{
item
.
id
.
upper
()
}
{
item
.
on_interaction_description
}
.
"
)
...
...
This diff is collapsed.
Click to expand it.
item_dist.py
+
2
−
0
View file @
b9275c64
...
...
@@ -12,6 +12,8 @@ NEED_ITEM_PAIRING = 0.6 # 60% of chests will need a key or other to be ope
ALLOW_MULTICHESTS
=
False
# Can one room have more than one chest in it?
CHANCE_NOTHING
=
15
# The numbers of entries in the raffle that result in nothing being place into the chest
EXCLUDE_CHESTS
=
[
spawn_room
]
# The rooms in which no chests can spawn - ever!
CHEST_NAMES
=
[]
KEY_NAMES
=
[]
# Item spawn probability file
PROBABILITIES_FILE
=
"
probabilities.json
"
...
...
This diff is collapsed.
Click to expand it.
items.py
+
14
−
95
View file @
b9275c64
...
...
@@ -296,7 +296,7 @@ class GiantSword(Weapon):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
giant sword
"
,
name
=
"
giant sword
"
,
description
=
"
The swords barely fits in your hand. Surely a relic of a grand warrior
"
,
attack
=
40
,
dura
=
100
,
...
...
@@ -307,7 +307,7 @@ class WornDagger(Weapon):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
worn dagger
"
,
name
=
"
worn dagger
"
,
description
=
"
The blade of this thing has seen better days
"
,
attack
=
20
,
dura
=
25
,
...
...
@@ -318,7 +318,7 @@ class PlasticSpoon(Weapon):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
plastic spoon
"
,
name
=
"
plastic spoon
"
,
description
=
"
I don
'
t think it
'
ll have much use defending against monsters...
"
,
attack
=
2
,
dura
=
10
,
...
...
@@ -329,7 +329,7 @@ class GolfClub(Weapon):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
golf club
"
,
name
=
"
golf club
"
,
description
=
"
Turns out the people who lived here were avid golf players.
"
,
attack
=
10
,
dura
=
50
,
...
...
@@ -351,7 +351,7 @@ class Whip(Weapon):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
creaky whip
"
,
name
=
"
creaky whip
"
,
description
=
"
I don
'
t want to know what this was used for... horses?
"
,
attack
=
5
,
dura
=
20
,
...
...
@@ -362,7 +362,7 @@ class Crocs(Defense):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
pair of crocs
"
,
name
=
"
pair of crocs
"
,
description
=
"
I doubt these will actually soften a blow. Yet their ugly style may distract the monsters
"
,
defense
=
0.05
,
dura
=
20
,
...
...
@@ -373,7 +373,7 @@ class SturdyShield(Defense):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
sturdy shield
"
,
name
=
"
sturdy shield
"
,
description
=
"
Seems like it can take a blow
"
,
defense
=
0.25
,
dura
=
100
,
...
...
@@ -384,7 +384,7 @@ class Apron(Defense):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
well used apron
"
,
name
=
"
well used apron
"
,
description
=
"
Covered in cooking stains. Clearly not cleaned all too well.
"
,
defense
=
0.1
,
dura
=
30
,
...
...
@@ -395,7 +395,7 @@ class SuitofArmour(Defense):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
A
pristine suit of armour
"
,
name
=
"
pristine suit of armour
"
,
description
=
"
Whoever owned this before took great care of it. It is still shiny!
"
,
defense
=
0.6
,
dura
=
150
,
...
...
@@ -406,7 +406,7 @@ class Cookies(HealthItem):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
pack of cookies
"
,
name
=
"
pack of cookies
"
,
description
=
"
Who cares how old these are? All I can think of is the taste of chocolate chip cookies!
"
,
health
=
40
,
)
...
...
@@ -415,7 +415,7 @@ class FirstAidKit(HealthItem):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
'
a
first aid kit
'
,
name
=
'
first aid kit
'
,
description
=
"
This can heal any ailment at a whim!
"
,
health
=
100
,
)
...
...
@@ -424,7 +424,7 @@ class Apple(HealthItem):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
an
apple
"
,
name
=
"
apple
"
,
description
=
"
An apple a day keeps the doctors away.
"
,
health
=
20
,
)
...
...
@@ -433,7 +433,7 @@ class StrangePotion(Magic):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
strange potion
"
,
name
=
"
strange potion
"
,
description
=
"
A vile of unknown contents. Doesn
'
t smell of anything.
"
,
magic
=
20
,
)
...
...
@@ -442,92 +442,11 @@ class Wine(Magic):
def
__init__
(
self
,
id
):
super
().
__init__
(
id
,
name
=
"
a
bottle of wine
"
,
name
=
"
bottle of wine
"
,
description
=
"
Bourgogne Pinot Noir 2003. Exquisite.
"
,
magic
=
10
,
)
spawn_chances
=
{
GiantSword
:
{
"
CHEST
"
:
4
,
"
dusty_bedroom
"
:
0.1
,
"
observatory
"
:
0.1
},
WornDagger
:
{
"
CHEST
"
:
5
,
"
ALL_ROOMS
"
:
0.25
,
"
kitchen
"
:
0.5
},
PlasticSpoon
:
{
"
ALL_ROOMS
"
:
0.3
,
"
CHEST
"
:
1
,
"
spawn_room
"
:
1.0
},
GolfClub
:
{
"
garage
"
:
1.0
},
Handgun
:
{
"
dusty_bedroom
"
:
0.3
,
"
CHEST
"
:
4
},
Whip
:
{
"
ALL_ROOMS
"
:
0.1
,
"
CHEST
"
:
3
,
"
dusty_bedroom
"
:
0.3
,
"
garage
"
:
0.3
},
Crocs
:
{
"
spawn_room
"
:
0.3
,
"
CHEST
"
:
4
,
"
first_hallway
"
:
0.5
,
"
dusty_bedroom
"
:
0.4
},
SturdyShield
:
{
"
first_hallway
"
:
0.3
,
"
observatory
"
:
0.25
,
"
CHEST
"
:
5
},
Apron
:
{
"
kitchen
"
:
0.8
,
"
wine_cellar
"
:
0.2
,
"
CHEST
"
:
1
},
SuitofArmour
:
{
"
high_tower
"
:
0.1
,
"
basement
"
:
0.1
,
"
garage
"
:
0.1
,
"
CHEST
"
:
5
},
Cookies
:
{
"
high_tower
"
:
0.1
,
"
basement
"
:
0.1
,
"
garage
"
:
0.1
,
"
CHEST
"
:
5
},
FirstAidKit
:
{
"
dusty_bedroom
"
:
0.1
,
"
conservatory
"
:
0.1
,
"
high_tower
"
:
0.3
,
"
CHEST
"
:
6
},
Apple
:
{
"
ALL_ROOMS
"
:
0.3
,
"
kitchen
"
:
0.8
},
StrangePotion
:
{
"
high_tower
"
:
0.5
,
"
garden
"
:
0.3
,
"
garage
"
:
0.2
,
"
observatory
"
:
0.2
,
},
Wine
:
{
"
conservatory
"
:
0.2
,
"
wine_cellar
"
:
0.9
,
"
kitchen
"
:
0.2
,
"
CHEST
"
:
4
},
}
spawnable_items
=
{
"
weapons
"
:
[
GiantSword
,
WornDagger
,
PlasticSpoon
,
GolfClub
,
Handgun
,
Whip
],
"
defense
"
:
[
Crocs
,
SturdyShield
,
Apron
,
SuitofArmour
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment