Library Of Ruina

Library Of Ruina

Library of Runia Workshop
Custom Head WorkShop_TEST
了解更多
Grey Rebl 2021 年 11 月 27 日 上午 9:59
Custom Counter Dice Passive
Currently undergoing programmer's pain at the moment because of the poor documentation on Passive Abilities. At first I thought: "It's just one counter dice passive, and all I have to do is find Red Mist's Retaliate as a reference. How hard could it be?"

Just a glance at it's long, looooong chain of class names by NUMBERS was enough make me a die inside as I click on them all one by one just to find CODE as the descriptor of what I'm looking for.

Got all the way down to PassiveAbility_250022() which I half-believe is the Guest verson of Red Mist's Ego passive. I'm probably close to finding Retaliate.

PassiveAbility_250222 is the closest I could get, but it's unlabeled and when I tried to make an exact copy of it in my custom mod, it doesn't seem to function.

At this point, I don't even know anymore. Send help plz. I am in hell.
< >
正在显示第 1 - 5 条,共 5 条留言
yarrrr 10 2021 年 11 月 27 日 下午 1:53 
Basically what Retaliate does is get the dice of a 'card' (Not played in-game but for the purpose of the ability) and adds it at the start of the battle as if you used a counter-only card.

I think copy&pasting retaliate code SHOULD work, though you might need to change the ID it's referencing to a card that will provide the counter die.
DiceCardXmlInfo cardItem = ItemXmlDataList.instance.GetCardItem(new LorId("modid", cardid), false);

replace "modid" with the ID of the mod you gave in the editor (include quotes), and cardid to the id of the card you use for the purpose of the passive ability.
Grey Rebl 2021 年 11 月 27 日 下午 3:08 
引用自 yarrrr
DiceCardXmlInfo cardItem = ItemXmlDataList.instance.GetCardItem(new LorId("modid", cardid), false);

Thanks, man. So this GETS the card information, but what about the activation?


DiceCardXmlInfo cardItem = ItemXmlDataList.instance.GetCardItem(607101, false); new DiceBehaviour(); List<BattleDiceBehavior> list = new List<BattleDiceBehavior>(); int num = 0; foreach (DiceBehaviour diceBehaviour in cardItem.DiceBehaviourList) { BattleDiceBehavior battleDiceBehavior = new BattleDiceBehavior(); battleDiceBehavior.behaviourInCard = diceBehaviour.Copy(); battleDiceBehavior.SetIndex(num++); list.Add(battleDiceBehavior); } this.owner.cardSlotDetail.keepCard.AddBehaviours(cardItem, list);

This is what I could dig up, though the most I could interpret this is so:

1. Get pre-existing battle page information (in this case, it's ID is 607101).
2. Create new object with dice behaviour.
3. Create new list of dice/battle page.
4. For every dice in the pre-existing battle page, copy and add to the new list
5. Keep new list for the battle phase??
yarrrr 10 2021 年 11 月 27 日 下午 4:57 
引用自 Grey Rebl
This is what I could dig up, though the most I could interpret this is so:

1. Get pre-existing battle page information (in this case, it's ID is 607101).
2. Create new object with dice behaviour.
3. Create new list of dice/battle page.
4. For every dice in the pre-existing battle page, copy and add to the new list
5. Keep new list for the battle phase??
Yeah that's correct. The line I mentioned is just to show what part you would need to change in order for it to work since I'm sure the rest of the code is functional, and referencing IDs from mods requires referencing the mod ID as well.
最后由 yarrrr 编辑于; 2021 年 11 月 27 日 下午 4:59
Grey Rebl 2021 年 11 月 27 日 下午 5:02 
引用自 yarrrr
Yeah that's correct. The line I mentioned is just to show what part you would need to change in order for it to work since I'm sure the rest of the code is functional, and referencing IDs from mods requires referencing the mod ID as well.

Thank you, this is a huge help!
Grey Rebl 2021 年 11 月 28 日 上午 9:20 
I've tried a whole bunch of things in case I was being silly with a human error or another, but, well, it turns out to have kinda...funky behavior.

public class PassiveAbility_method_tester : PassiveAbilityBase { public override void OnStartBattle() { //This works by itself this._count = 3; owner.bufListDetail.AddKeywordBufThisRoundByEtc(KeywordBuf.Strength, this._count, owner); //Adding this would fail all steps in OnStartBattle for some reason. DiceCardXmlInfo cardItem = ItemXmlDataList.instance.GetCardItem(new LorId("Echo", 7), false); new DiceBehaviour(); List<BattleDiceBehavior> list = new List<BattleDiceBehavior>(); int num = 0; foreach (DiceBehaviour diceBehaviour in cardItem.DiceBehaviourList) { BattleDiceBehavior battleDiceBehavior = new BattleDiceBehavior(); battleDiceBehavior.behaviourInCard = diceBehaviour.Copy(); battleDiceBehavior.SetIndex(num++); list.Add(battleDiceBehavior); } owner.cardSlotDetail.keepCard.AddBehaviours(cardItem, list); } }

Can confirm that it's code for Retaliate at least. Worked around by opening EquipPage, finding the Keypage with the passive, and then matched the passive ID. Also, copying/pasting the original didn't work as I've mentioned before.
< >
正在显示第 1 - 5 条,共 5 条留言
每页显示数: 1530 50