@@ -269,7 +269,7 @@ export default function GachaCalc({ location }: { location: string }) {
269269 < h1 className = "text-5xl font-bold pb-2" > Gacha rate calculator</ h1 >
270270
271271 < NumberInput label = "Pulls" set = { setPulls } value = { pulls } min = { 0 } max = { 1260 * gachaTargets . length } />
272- { gachaTargets . map ( ( gachaTarget , index ) => < div key = { gachaTarget . id } className = { `bg-slate-600 ${ gachaTarget . enabled ? "" : "bg-opacity-25 bg-red-800 " } rounded-xl p-1 my-2 flex flex-row gap-2` } >
272+ { gachaTargets . map ( ( gachaTarget , index ) => < div key = { gachaTarget . id } className = { `${ gachaTarget . enabled ? " bg-slate-300 dark:bg-slate-600 " : "bg-opacity-25 bg-red-600 " } rounded-xl p-1 my-2 flex flex-row gap-2` } >
273273 < div className = "flex flex-col items-center justify-center gap-2" >
274274 < div >
275275 < button className = "bg-slate-900 text-slate-50 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed text-center rounded-lg px-2 py-1"
@@ -320,7 +320,7 @@ export default function GachaCalc({ location }: { location: string }) {
320320 < div className = "w-full bg-slate-800 rounded-xl p-1 my-2 md:my-0 text-white col-start-1" >
321321 < Bar
322322 data = { {
323- labels : lastEntry . filter ( ( x ) => x ) . map ( ( c ) => getName ( c ) ) ,
323+ labels : lastEntry . filter ( ( x ) => x ) . map ( ( c ) => getName ( c , gachaTargets ) ) ,
324324 datasets : [ {
325325 label : "Rate" ,
326326 backgroundColor : "rgb(75, 192, 192)" ,
@@ -352,7 +352,7 @@ export default function GachaCalc({ location }: { location: string }) {
352352 </ div >
353353 < div className = "w-full bg-slate-800 rounded-xl p-1 my-2 md:my-0 text-white col-start-2" >
354354 < Line data = { {
355- labels : lastEntry . filter ( x => x ) . map ( c => getName ( c ) ) ,
355+ labels : lastEntry . filter ( x => x ) . map ( c => getName ( c , gachaTargets ) ) ,
356356 datasets : [ {
357357 label : "Cumulative rate" ,
358358 borderColor : "rgb(255, 99, 132)" ,
@@ -392,7 +392,7 @@ export default function GachaCalc({ location }: { location: string }) {
392392 labels : calculated . map ( ( _ , i ) => i ) ,
393393 datasets : consts
394394 . map ( ( gtc , x , arr ) => ( {
395- label : getName ( gtc ) ,
395+ label : getName ( gtc , gachaTargets ) ,
396396 backgroundColor : getColor ( gtc , enabledTargets , 1 ) ,
397397 borderColor : getColor ( gtc , enabledTargets , 1 ) ,
398398 fill : {
@@ -434,7 +434,7 @@ export default function GachaCalc({ location }: { location: string }) {
434434 />
435435 </ div >
436436 < h3 className = "text-lg font-bold pt-1" id = "table" > Rate Table</ h3 >
437- < table className = { `table-auto w-80 ${ styles . table } ${ styles . stattable } my-2 sm:text-base text-sm` } >
437+ < table className = { `table-auto w-96 ${ styles . table } ${ styles . stattable } my-2 sm:text-base text-sm` } >
438438 < thead >
439439 < tr className = "divide-x divide-gray-200 dark:divide-gray-500" >
440440 < th > { constName } </ th >
@@ -451,14 +451,14 @@ export default function GachaCalc({ location }: { location: string }) {
451451 . filter ( ( x ) => x )
452452 . map ( ( c , i , a ) => (
453453 < tr className = { `pr-1 divide-x divide-gray-200 dark:divide-gray-500 ${ c . rate < 0.0005 ? "opacity-60" : "" } ` } key = { i } >
454- < td > { getName ( c ) } </ td >
455- < td title = { getName ( c ) == "Not owned" ?
454+ < td > { getName ( c , gachaTargets ) } </ td >
455+ < td title = { getName ( c , gachaTargets ) == "Not owned" ?
456456 `Chance to NOT get any of the wanted item within ${ pulls } pulls` :
457- `Chance to get exactly ${ getName ( c ) } (and NOT higher) within ${ pulls } pulls`
457+ `Chance to get exactly ${ getName ( c , gachaTargets ) } (and NOT higher) within ${ pulls } pulls`
458458 } > { ( c . rate * 100 ) . toFixed ( 3 ) } %</ td >
459- < td title = { getName ( c ) == "Not owned" ?
459+ < td title = { getName ( c , gachaTargets ) == "Not owned" ?
460460 "Chance to get nothing or higher, so basically always 100%" :
461- `Chance to get ${ getName ( c ) } or higher within ${ pulls } pulls`
461+ `Chance to get ${ getName ( c , gachaTargets ) } or higher within ${ pulls } pulls`
462462 } > { ( a . slice ( i , a . length ) . reduce ( ( p , c ) => p + c . rate , 0 ) * 100 ) . toFixed ( 2 ) } %</ td >
463463 </ tr >
464464 ) ) }
@@ -519,9 +519,31 @@ function getColor({ const: c, gachaTargetIndex }: { const: number, gachaTargetIn
519519 return colors [ totalIndex % colors . length ]
520520}
521521
522- function getName ( { const : c , gachaTarget } : { const : number , gachaTarget : GachaTarget } ) {
523- return c == gachaTarget . banner . minConst ? "Not owned" : `${ gachaTarget . banner . constFormat } ${ c } `
522+ function getName ( gt : { const : number , gachaTarget : GachaTarget } , gachaTargets : GachaTarget [ ] ) {
523+ const gachaTarget = gt . gachaTarget
524+ if ( gt . const == gachaTarget . target ) {
525+ const nextTarget = gachaTargets . slice ( gachaTargets . findIndex ( gt => gt . id == gachaTarget . id ) + 1 ) . find ( gt => gt . enabled )
526+ if ( ! nextTarget ) return getRawName ( gt , gachaTargets )
527+ return `${ getRawName ( gt , gachaTargets ) } / ${ getRawName ( { const : nextTarget . current , gachaTarget : nextTarget } , gachaTargets ) } `
528+ }
529+
530+ if ( gt . const == gachaTarget . current ) {
531+ const prevTarget = gachaTargets . slice ( 0 , gachaTargets . findIndex ( gt => gt . id == gachaTarget . id ) ) . reverse ( ) . find ( gt => gt . enabled )
532+ if ( ! prevTarget ) return getRawName ( gt , gachaTargets )
533+ return `${ getRawName ( { const : prevTarget . target , gachaTarget : prevTarget } , gachaTargets ) } / ${ getRawName ( gt , gachaTargets ) } `
534+ }
535+
536+ return getRawName ( gt , gachaTargets )
524537}
538+
539+ function getRawName ( { const : c , gachaTarget } : { const : number , gachaTarget : GachaTarget } , gachaTargets : GachaTarget [ ] ) {
540+ const name = c == gachaTarget . banner . minConst ? "Not owned" : `${ gachaTarget . banner . constFormat } ${ c } `
541+ if ( gachaTargets . length == 1 ) return name
542+ const index = gachaTargets . findIndex ( gt => gt . id == gachaTarget . id )
543+ const banner = `${ index + 1 } . `
544+ return `${ banner } ${ name } `
545+ }
546+
525547function GachaTargetInput ( {
526548 value,
527549 set,
0 commit comments