Skip to content

Instantly share code, notes, and snippets.

@IronMonk-UK
Created April 6, 2016 17:09
Show Gist options
  • Save IronMonk-UK/d2041ebc158344bc365f4e9dcaf42f2d to your computer and use it in GitHub Desktop.
Save IronMonk-UK/d2041ebc158344bc365f4e9dcaf42f2d to your computer and use it in GitHub Desktop.
foreach userUnit u
userUnit target
pathTarget = u.node
if indexOf u.node + 1 <= movement + 1
bool inRange = true
if inRange
List<UserUnit> UnitsInRange
foreach userUnit u
pathTarget = u.node
if indexOf u.node + 1 <= movement + 1
UnitsInRange.Add u
if UnitsInRange.Count > 1
bool multiUnits = true
if !multiUnits
followPath next to target
Attack target
if multiUnits
foreach userUnit u in UnitsInRange
if u.equippedWeapon.weaponType == equippedWeapon.posWeaponType
bool RPSwin = true
target = u
else
if i = 0
i = path.Count - 1
target = u
else if path.Count < i
i = path.Count - 1
target = u
followPath next to target
Attack target
if !inRange
int i = 0
foreach userUnit u
pathTarget = u.node
if i = 0
i = path.Count - 1
target = u
else if path.Count < i
i = path.Count - 1
target = u
if path.Count - 1 <= target.movement
bool inRangeOfEnemy = true
if inRangeofEnemy
if currentHP <= maxHP - 10
bool canUseHealth = true
if !canUseHealth
if path[0].x = thisNode.x + 1
bool pathIsRight
if path[0].x = thisNode.x - 1
bool pathIsLeft
if path[0].x = thisNode.y + 1
bool pathIsUp
if path[0].x = thisNode.y - 1
bool pathIsDown
if pathIsRight
path set to furthest left node
if pathIsLeft
path set to furthest right node
if pathIsUp
path set to furthest down node
if pathIsDown
path set to furthest up node
followPath as much as possible
if canUseHealth
foreach item i in inventory
if i.itemType = health
bool healthToUse
if !healthToUse
if path[0].x = thisNode.x + 1
bool pathIsRight
if path[0].x = thisNode.x - 1
bool pathIsLeft
if path[0].x = thisNode.y + 1
bool pathIsUp
if path[0].x = thisNode.y - 1
bool pathIsDown
if pathIsRight
path set to furthest left node
if pathIsLeft
path set to furthest right node
if pathIsUp
path set to furthest down node
if pathIsDown
path set to furthest up node
followPath as much as possible
if healthToUse
if path[0].x = thisNode.x + 1
bool pathIsRight
if path[0].x = thisNode.x - 1
bool pathIsLeft
if path[0].x = thisNode.y + 1
bool pathIsUp
if path[0].x = thisNode.y - 1
bool pathIsDown
if pathIsRight
path set to furthest left node
if pathIsLeft
path set to furthest right node
if pathIsUp
path set to furthest down node
if pathIsDown
path set to furthest up node
followPath as much as possible
useHealthVial
if !inRangeOfEnemy
if currentHP <= maxHP - 10
bool canUseHealth = true
if !canUseHealth
EndTurn
if canUseHealth
foreach item i in inventory
if i.itemType = health
bool healthToUse
if healthToUse
useHealthVial
EndTurn
if !healthToUse
EndTurn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment