public void Add()
            {
                this.stack++;
                this.addedThisTurn++;
                BattleCardTotalResult battleCardResultLog = this._owner.battleCardResultLog;

                if (battleCardResultLog != null)
                {
                    battleCardResultLog.SetCreatureEffectSound("Creature/ButterFlyMan_Lock");
                }
                int num = this._owner.passiveDetail.SpeedDiceNumAdder() - this._owner.passiveDetail.SpeedDiceBreakAdder() - this._owner.bufListDetail.SpeedDiceBreakAdder() + this.addedThisTurn - 1;

                if (num >= 0 && num < this._owner.speedDiceResult.Count && this._owner.cardSlotDetail.cardAry[num].GetRemainingAbilityCount() > 0)
                {
                    this._owner.cardSlotDetail.cardAry[num].DestroyDice(DiceMatch.AllDice, DiceUITiming.Start);
                }
            }
Ejemplo 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);
            }