Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What Essentials had:
- n = temp.length
- for m in 0...temp.length-1
- for i in 1...temp.length
- # For each pair of battlers, rank the second compared to the first.
- # -1 means rank higher, 0 means rank equal, 1 means rank lower
- cmp = 0
- if quickclaw[temp[i]]
- cmp = -1
- if quickclaw[temp[i-1]]
- if speeds[temp[i]]==speeds[temp[i-1]]
- cmp = 0
- else
- cmp = (speeds[temp[i]]>speeds[temp[i-1]]) ? -1 : 1
- end
- end
- elsif quickclaw[temp[i-1]]
- cmp = 1
- elsif lagging[temp[i]]
- cmp = 1
- if lagging[temp[i-1]]
- if speeds[temp[i]]==speeds[temp[i-1]]
- cmp = 0
- else
- cmp = (speeds[temp[i]]>speeds[temp[i-1]]) ? 1 : -1
- end
- end
- elsif lagging[temp[i-1]]
- cmp = -1
- elsif speeds[temp[i]]!=speeds[temp[i-1]]
- if @field.effects[PBEffects::TrickRoom]>0
- cmp = (speeds[temp[i]]>speeds[temp[i-1]]) ? 1 : -1
- else
- cmp = (speeds[temp[i]]>speeds[temp[i-1]]) ? -1 : 1
- end
- end
- if cmp<0 || # Swap the pair according to the second battler's rank
- (cmp==0 && pbRandom(2)==0)
- temp[i],temp[i-1] = temp[i-1],temp[i]
- end
- end
- end
- What Essentials has now:
- # Sort by speed
- if @field.effects[PBEffects::TrickRoom]>0
- temp.sort!{|a,b| (a==b) ? pbRandom(2) : speeds[a]<=>speeds[b]}
- else
- temp.sort!{|a,b| (a==b) ? pbRandom(2) : speeds[b]<=>speeds[a]}
- end
- # Move Quick Clawers and laggers to the start/end
- q = []; l = []
- for i in 0...temp.length
- if quickclaw[temp[i]]
- q[q.length] = temp[i]; temp[i] = nil
- end
- if lagging[temp[i]]
- l[l.length] = temp[i]; temp[i] = nil
- end
- end
- temp.compact!
- temp = q + temp + l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement