static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            var codes         = instructions.ToList();
            var get_party_idx = codes.FindIndex(x => x.opcode == System.Reflection.Emit.OpCodes.Callvirt && x.operand.ToString().Contains("Party"));

            codes[get_party_idx] = new Harmony12.CodeInstruction(System.Reflection.Emit.OpCodes.Call,
                                                                 new Func <List <UnitEntityData> >(getPartyRevealars).Method
                                                                 );

            return(codes.AsEnumerable());
        }
Beispiel #2
0
        static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            var codes           = instructions.ToList();
            var check_dex_index = codes.FindIndex(x => x.opcode == System.Reflection.Emit.OpCodes.Callvirt && x.operand.ToString().Contains("get_Bonus"));

            codes[check_dex_index - 1] = new Harmony12.CodeInstruction(System.Reflection.Emit.OpCodes.Call,
                                                                       new Func <CharacterStats, ModifiableValueAttributeStat>(getAcStat).Method
                                                                       );

            return(codes.AsEnumerable());
        }
            static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
            {
                var codes = instructions.ToList();
                var check_magus_spell_list = codes.FindIndex(x => x.opcode == System.Reflection.Emit.OpCodes.Callvirt && x.operand.ToString().Contains("IsSpellFromMagusSpellList"));

                codes[check_magus_spell_list] = new Harmony12.CodeInstruction(System.Reflection.Emit.OpCodes.Call,
                                                                              new Func <UnitPartMagus, AbilityData, bool>(MagusController_HandleUnitRunCommand_Patch.canUseSpellForSpellCombat).Method
                                                                              );

                return(codes.AsEnumerable());
            }
        static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            var codes             = instructions.ToList();
            var check_threat_hand = codes.FindIndex(x => x.opcode == System.Reflection.Emit.OpCodes.Call && x.operand.ToString().Contains("GetThreatHand"));

            codes[check_threat_hand] = new Harmony12.CodeInstruction(System.Reflection.Emit.OpCodes.Ldarg_1);
            codes.Insert(check_threat_hand + 1, new Harmony12.CodeInstruction(System.Reflection.Emit.OpCodes.Call,
                                                                              new Func <UnitEntityData, UnitEntityData, WeaponSlot>(canMakeAoo).Method
                                                                              )
                         );
            return(codes.AsEnumerable());
        }
        static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            var codes        = instructions.ToList();
            var add_fact_idx = codes.FindIndex(x => x.opcode == System.Reflection.Emit.OpCodes.Call && x.operand.ToString().Contains("AddFact"));

            codes[add_fact_idx] = new Harmony12.CodeInstruction(System.Reflection.Emit.OpCodes.Call,
                                                                new Func <UnitDescriptor, BlueprintUnitFact, MechanicsContext, FeatureParam, Kingmaker.UnitLogic.Feature>(maybeAddFact).Method
                                                                );


            return(codes.AsEnumerable());
        }