1+ function work ( data ) {
2+ return idrinth . calculate (
3+ new idrinth . StatSet ( data . attack , data . defense , data . perception , data . level , data . stats ) ,
4+ new idrinth . PremiumSet ( data . utym , data . mirele , data . kraken ) ,
5+ new idrinth . MultiplierSet ( data . legion , data . mount , data . critchance )
6+ ) ;
7+ } ;
8+ var idrinth = {
9+ PremiumSet : function ( utym , mirele , kraken ) {
10+ this . utym = utym ;
11+ this . mirele = mirele ;
12+ this . kraken = kraken ;
13+ this . modifyBase = function ( base , stat , stats ) { } ;
14+ this . modifyTotal = function ( base , stat , stats ) { } ;
15+ } ,
16+ MultiplierSet : function ( legion , mount , critchance ) {
17+ this . legion = legion ;
18+ this . mount = mount ;
19+ this . critchance = critchance ;
20+ this . modifyTotal = function ( base , stat , stats , premiums ) { } ;
21+ } ,
22+ StatSet : function ( attack , defense , perception , level , stats ) {
23+ this . attack = attack ;
24+ this . defense = defense ;
25+ this . perception = perception ;
26+ this . stats = stats ;
27+ this . level = level ;
28+ this . getCost = function ( value ) {
29+ let toPositive = function ( number ) {
30+ return Math . max ( number , 0 ) ;
31+ } ;
32+ return 1 + Math . ceil (
33+ toPositive (
34+ value -
35+ 10000 -
36+ Math . floor ( toPositive ( this . level / 500 - 2 ) ) * 1500
37+ ) / 1500
38+ ) ;
39+ } ;
40+ this . getIncreaseableStats = function ( ) {
41+ let stats = [ ] ;
42+ if ( this . getCost ( this . attack ) <= this . stats ) {
43+ stats . push ( 'attack' ) ;
44+ }
45+ if ( this . getCost ( this . defense ) <= this . stats ) {
46+ stats . push ( 'defense' ) ;
47+ }
48+ if ( this . getCost ( this . perception ) <= this . stats ) {
49+ stats . push ( 'perception' ) ;
50+ }
51+ return stats ;
52+ } ;
53+ } ,
54+ /**
55+ * @param {idrinth.StatSet } stat
56+ * @param {idrinth.PremiumSet } premium
57+ * @param {idrinth.MultiplierSet } multiplier
58+ * @return {idrinth.StatSet }
59+ */
60+ calculate ( stat , premium , multiplier ) {
61+ let modified = false
62+ do {
63+ stat . getIncreaseableStats ( ) . forEach ( ) ;
64+ } while ( modified )
65+ return stat ;
66+ }
67+ } ;
0 commit comments