mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-06 00:38:18 +00:00
Merge branch 'master' of bitbucket.org:Major-/apollo into pathfinding.
This commit is contained in:
@@ -10,7 +10,6 @@
|
|||||||
<scripts>
|
<scripts>
|
||||||
<script>actions.rb</script>
|
<script>actions.rb</script>
|
||||||
<script>areas.rb</script>
|
<script>areas.rb</script>
|
||||||
<script>wilderness.rb</script>
|
|
||||||
</scripts>
|
</scripts>
|
||||||
<dependencies />
|
<dependencies />
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<plugin>
|
||||||
|
<id>combat</id>
|
||||||
|
<version>1</version>
|
||||||
|
<name>Combat</name>
|
||||||
|
<description>Manages combat between game characters.</description>
|
||||||
|
<authors>
|
||||||
|
<author>Ryley</author>
|
||||||
|
</authors>
|
||||||
|
<scripts>
|
||||||
|
<script>wilderness.rb</script>
|
||||||
|
</scripts>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>attributes</dependency>
|
||||||
|
<dependency>areas</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
@@ -50,4 +50,13 @@ area_action :wilderness_level do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Monkey patch the existing player class to add method of checking whether or not a player is within the wilderness
|
||||||
|
class Player
|
||||||
|
|
||||||
|
def in_wilderness
|
||||||
|
self.wilderness_level > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
area :name => :wilderness, :coordinates => [ 2945, 3522, 3390, 3972, 0 ], :actions => :wilderness_level
|
area :name => :wilderness, :coordinates => [ 2945, 3522, 3390, 3972, 0 ], :actions => :wilderness_level
|
||||||
@@ -10,7 +10,7 @@ class PlayerAction
|
|||||||
|
|
||||||
def initialize(slot, primary, name)
|
def initialize(slot, primary, name)
|
||||||
index = [ :first, :second, :third, :fourth, :fifth ].find_index(slot)
|
index = [ :first, :second, :third, :fourth, :fifth ].find_index(slot)
|
||||||
raise "Unsupport action slot #{slot}." if index.nil?
|
raise "Unsupported action slot #{slot}." if index.nil?
|
||||||
|
|
||||||
@slot = index
|
@slot = index
|
||||||
@primary = primary
|
@primary = primary
|
||||||
@@ -55,7 +55,7 @@ class Player
|
|||||||
end
|
end
|
||||||
|
|
||||||
def has_action(action)
|
def has_action(action)
|
||||||
return actions[action.slot] == action.name
|
actions[action.slot] == action.name
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user