Amiibo drops

Revision as of 09:31, 26 October 2018 by imported>Leoetlino (→‎registerAmiibo)

Drop tables

Idx Name Description
0 Normal
1 Normal2
2 SmallHit
3 SmallHit2
4 BigHit
5 BigHit2
6 GreatHit
7 GreatHit2

Notes on AmiiboMgr

amiibo code call AmiiboMgr::registerAmiibo[unofficial name][1] every time an amiibo is used.

registerAmiibo

  • First, AmiiboMgr determines if it should reset its daily amiibo use history (stored in the AmiiboTouchHistory flag)[2].
    • If less than 86400 seconds (1 day) have elapsed since the game was launched, don't do anything.[check]
    • AmiiboMgr then computes 10000 * now.year + 100 * now.month + now.day. If the value is different from AmiiboLastTouchDate (which would mean that a day has elapsed), the AmiiboTouchHistory array is cleared.
  • The amiibo UID is inserted into AmiiboTouchHistory. Only the last 100 entries are kept.
  • It is also inserted into AmiiboTouchHistoryTotal. Only the last 200 entries are kept.
  • Finally, AmiiboLastTouchDate is set to 10000 * now.year + 100 * now.month + now.day.

Logic

AIDef:Action/ItemAmiiboCreateFromDropTable (the action that is responsible for determining the drop table and spawning the drops) follows the following process:

  • Get the number of times the amiibo has been scanned for the current day (using AmiiboTouchHistory): $scanCount
  • Get the number of times the amiibo has been scanned (using AmiiboTouchHistoryTotal): $scanCountTotal
  • Determine the drop table category to use.
    • Remain if Find_4Relic_1stClear is set
    • Parasail if IsGet_PlayerStole2 is set
    • Normal otherwise
  • Calculate the "adjust rate"
    • When the amiibo has been scanned 0 to $HitRateAdjustStart times, the adjust rate is 0%.
    • This value increases linearly and reaches its maximum (100%) when the amiibo scan count is >= $HitRateAdjustEnd.
    • In practice, because HitRateAdjustStart and HitRateAdjustEnd are both set to the same value (5), the formula can be simplified: the rate is 100% if $scanCountTotal >= $HitRateAdjustEnd and 0% otherwise.
  • Determine if there should be a Great Hit (RNG)
    • If $scanCount is <2, use GreatHitRate1st as the probability of getting a Great Hit.
    • If $scanCount is 2, use GreatHitRate2nd.
    • If $scanCount is 3, use GreatHitRate3rd.
    • In these three cases, if the great hit rate is >0.0, add adjustRate * (100.0 - greatHitRate) to the great hit rate.
    • Otherwise, if $scanCount is >3, the great hit rate is 0%.
  • If there was no Great Hit, determine if there should be a Big Hit (no RNG)
    • If $scanCount <= 3, a Big Hit is guaranteed.
    • If $scanCount >= 4, a Big Hit will never happen.
  • Determine if there should be a Small Hit (RNG)
    • If $scanCount is <2, use SmallHitRate1st.
    • If $scanCount is 2, use SmallHitRate2nd.
    • If $scanCount is 3, use SmallHitRate3rd.
    • Otherwise, if $scanCount is >3, the small hit rate is 0%.
  • Determine the drop num rate
    • If $scanCount is <2, use DropNumRate1st.
    • If $scanCount is 2, use DropNumRate2nd.
    • If $scanCount is 3, use DropNumRate3rd.
    • Otherwise, if $scanCount is >3, the drop num rate is 0%.
  • For each drop table ({Normal,SmallHit,BigHit,GreatHit}{,2}), calculate the actual drop num.
    • 0 if the table doesn't exist in the bdrop
    • max(1, (dropNumRate * repeatNum) / 100.0) otherwise
    • Note: For BigHit and GreatHit tables, (Remain), (Parasail) or (Normal) are appended to the table name.
  • Fix the drop nums based on the RNG results
Final drop nums after RNG (note: negative values are set to 0)
Normal Normal2 SmallHit SmallHit2 BigHit BigHit2 GreatHit GreatHit2
GH, no BH, no SH, Normal2 != 0 N - (GH+GH2)/2 N2 - (GH+GH2)/2 0 0 0 0 GH GH2
GH, no BH, no SH, Normal2 = 0 N - (GH+GH2) 0 0 0 0 0 GH GH2
GH, no BH, SH, Normal2 != 0 N - (GH+GH2)/2 N2 - (GH+GH2)/2 SH SH2 0 0 GH GH2
GH, no BH, SH, Normal2 = 0 N - (GH+GH2) 0 SH SH2 0 0 GH GH2
No GH, BH, no SH, Normal2 != 0 N - (BH+BH2)/2 N2 - (BH+BH2/2) 0 0 BH BH2 0 0
No GH, BH, no SH, Normal2 = 0 N - (BH+BH2) 0 0 0 BH BH2 0 0
No GH, BH, SH, Normal2 != 0 N - (BH+BH2)/2 N2 - (BH+BH2/2) SH SH2 BH BH2 0 0
No GH, BH, SH, Normal2 = 0 N - (BH+BH2) 0 SH SH2 BH BH2 0 0
No GH, no BH, SH N N2 SH SH2 0 0 0 0
No GH, no BH, no SH N N2 0 0 0 0 0 0

References

  1. 0x710064B564 on Switch 1.5.0
  2. 0x710064B3C8