Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Spirit Barrage Playstyle: Frame Sniping
- Delay Optimization
- by MarioVX
- '''
- from math import ceil
- def average_ticks_per_frame(fpa, delay):
- '''
- Calculate average ticks per frame.
- Args:
- fpa (int): Frames per Attack of Spirit Barrage
- delay (int): The number of frames you wait after finishing
- the 3rd use of Spirit Barrage before starting the next.
- Returns:
- float: average ticks per frame.
- '''
- # total duration is 3 times FPA and the delay you wait thereafter
- duration = 3*fpa + delay
- # ticks: ticks_1 + ticks_2 + ticks_3, for each phantasm:
- # a phantasms ticks is its lifetime divided by 30 frames, rounded up,
- # but caps at 10.
- ticks = min(ceil(duration/30),10)
- return ticks/duration
- def optimal_delay(fpa):
- '''
- Find the optimal delay for a given FPA.
- Args:
- fpa (int): Frames per Attack of Spirit Barrage
- Returns:
- tuple: (optimal delay, average ticks per frame at that delay)
- In case of tie, use longer delay to conserve Mana.
- '''
- # Generate tuples for all conceivable delays.
- # max delay is up to the last tick of the third phantasm
- all = [(i, average_ticks_per_frame(fpa, i)) for i in range(271-fpa)]
- # sort the tuples in the desired order, return only its first.
- return sorted(all, key=lambda x: (-x[1],-x[0]))[0]
- # generate a map: fpa -> optimal_delay(fpa) for FPA from 1 to 48.
- optimals = dict((i,optimal_delay(i)) for i in range(1,49))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement