public override void OnRollDice(BattleDiceBehavior behavior)
 {
     if (behavior.DiceVanillaValue > behavior.GetDiceMin() && behavior.DiceVanillaValue < behavior.GetDiceMax())
     {
         return;
     }
     base.OnRollDice(behavior);
     this._owner.battleCardResultLog?.SetNewCreatureAbilityEffect("8_B/FX_IllusionCard_8_B_Judgement", 3f);
     this._owner.battleCardResultLog?.SetCreatureEffectSound("Creature/LongBird_Stun");
 }
Exemplo n.º 2
0
            static bool Prefix(BattleDiceBehavior __instance, ref int ____diceResultValue)
            {
                if (__instance.owner.faction == Faction.Player)
                {
                    var originalRollChance = RandomUtil.valueForProb;
                    if (originalRollChance > CARD_DICE_CHANGE_PROB)
                    {
                        //logger.LogDebug($"Using original dice roll at {Math.Round(1 - CARD_DICE_CHANGE_PROB, 2) * 100} < {Math.Round(1 - CARD_DICE_CHANGE_PROB, 2) * 100} chance");
                        return(true);
                    }
                    int diceMin = (int)Math.Ceiling(__instance.GetDiceMin() * CARD_DICE_MIN_MULT);
                    //int diceMax = (int)Math.Ceiling(__instance.GetDiceMax() * CARD_DICE_MAX_MULT);
                    int diceMax = __instance.GetDiceMax();
                    diceMin = Math.Min(diceMin, diceMax);

                    logger.LogDebug($"{__instance.card.card.GetName()} dice min: ({__instance.GetDiceMin()} => {diceMin}) / ({__instance.GetDiceMax()} => {diceMax})");

                    int trueMin = Mathf.Min(diceMin, diceMax);
                    ____diceResultValue = DiceStatCalculator.MakeDiceResult(diceMin, diceMax, 0);
                    __instance.owner.passiveDetail.ChangeDiceResult(__instance, ref ____diceResultValue);
                    __instance.owner.emotionDetail.ChangeDiceResult(__instance, ref ____diceResultValue);
                    __instance.owner.bufListDetail.ChangeDiceResult(__instance, ref ____diceResultValue);
                    if (____diceResultValue < trueMin)
                    {
                        ____diceResultValue = trueMin;
                    }
                    int numPosCoins = 0;
                    int numNegCoins = 0;
                    if (trueMin != diceMax)
                    {
                        if (____diceResultValue >= diceMax)
                        {
                            numPosCoins++;
                        }
                        else if (____diceResultValue <= trueMin)
                        {
                            numNegCoins++;
                        }
                    }
                    if (____diceResultValue < 1)
                    {
                        ____diceResultValue = 1;
                    }
                    BattleCardTotalResult battleCardResultLog = __instance.owner.battleCardResultLog;
                    if (numPosCoins > 0)
                    {
                        int posEmotion = __instance.owner.emotionDetail.CreateEmotionCoin(EmotionCoinType.Positive, numPosCoins);
                        if (battleCardResultLog != null)
                        {
                            battleCardResultLog.AddEmotionCoin(EmotionCoinType.Positive, posEmotion);
                        }
                    }
                    else if (numNegCoins > 0)
                    {
                        int negEmotion = __instance.owner.emotionDetail.CreateEmotionCoin(EmotionCoinType.Negative, numNegCoins);
                        if (battleCardResultLog != null)
                        {
                            battleCardResultLog.AddEmotionCoin(EmotionCoinType.Negative, negEmotion);
                        }
                    }
                    __instance.card.OnRollDice(__instance);
                    __instance.OnEventDiceAbility(DiceCardAbilityBase.DiceCardPassiveType.RollDice, null);
                    __instance.isUsed = true;
                    return(false);
                }
                return(true);
            }