Skip to content

Commit

Permalink
Clone logic addition
Browse files Browse the repository at this point in the history
  • Loading branch information
stjohncj committed Sep 15, 2013
1 parent 4272a83 commit 8af1c59
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions players/pwned.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,11 @@ def opponent_to_attack
end
end
if attackee.nil? #should be just me and my clones
attackee = brethren_to_kill
#attackee = random_from(alive_pwned)
attackee = random_from(alive_pwned)
end
return attackee
end

def brethren_to_kill
raise 'There are still opponents! You have a bug!' if alive_opponents.count > 0
clones = Game.world[:players].select{|p| p != self && p.alive }
clones.first
end

def groups_roaming?
alive_opponents.each do |opponent|
return true if is_in_a_group?(opponent)
Expand Down Expand Up @@ -213,30 +206,30 @@ def is_in_a_group?(opponent)

end

module PwnedCloneLeft
module PwnedClone
include Pwned
def to_s; "__pwned_clone_left"; end

def should_rest?
return true if is_vulnerable? or in_mob_attack_danger?
return true if alive_opponents.count == 0 # bow to my master
return false
end
end

module PwnedCloneLeft
include PwnedClone

def to_s; "__pwned_clone_left"; end

def my_target_in(opponents)
opponents[-1]
end
end

module PwnedCloneRight
include Pwned
def to_s; "__pwned_clone_right"; end
include PwnedClone

def should_rest?
return true if is_vulnerable? or in_mob_attack_danger?
return true if alive_opponents.count == 0 # bow to my master
return false
end
def to_s; "__pwned_clone_right"; end

def my_target_in(opponents)
opponents[1]
Expand Down

0 comments on commit 8af1c59

Please sign in to comment.