Example #1
0
 private static void CreateCostDefGurrenSummon()
 {
     costTypeDefGurrenSummon = new CostTypeDef();
     costTypeDefGurrenSummon.costStringFormatToken = "COST_LUNARCOIN_FORMAT";
     costTypeDefGurrenSummon.isAffordable          = delegate(CostTypeDef costTypeDef, CostTypeDef.IsAffordableContext context)
     {
         CharacterBody characterBody = context.activator.GetComponent <CharacterBody>();
         bool          result        = false;
         if (characterBody && characterBody.bodyIndex == BodyCatalog.FindBodyIndex("LagannBody"))
         {
             var master = characterBody.master;
             if (master)
             {
                 var         gurrenMinionCache = GurrenMinionCache.GetOrSetGurrenStatusCache(master);
                 NetworkUser networkUser       = Util.LookUpBodyNetworkUser(context.activator.gameObject);
                 result = (networkUser &&
                           (ulong)networkUser.lunarCoins >= (ulong)((long)context.cost) &&
                           !gurrenMinionCache.gurrenMinion);
             }
         }
         return(result);
     };
     costTypeDefGurrenSummon.payCost = delegate(CostTypeDef costTypeDef, CostTypeDef.PayCostContext context)
     {
         NetworkUser networkUser = Util.LookUpBodyNetworkUser(context.activator.gameObject);
         bool        flag        = networkUser;
         if (flag)
         {
             networkUser.DeductLunarCoins((uint)context.cost);
         }
     };
     costTypeDefGurrenSummon.colorIndex = ColorCatalog.ColorIndex.LunarCoin;
     CostTypeDefs.Add(costTypeDefGurrenSummon);
 }
Example #2
0
 private static void SceneDirector_PopulateScene(On.RoR2.SceneDirector.orig_PopulateScene orig, SceneDirector self)
 {
     if (gurrenInteractSpawnCard && Run.instance.userMasters.Values.Any((x) =>
     {
         if (x != null && x.bodyPrefab != null)
         {
             var body = x.bodyPrefab.GetComponent <CharacterBody>();
             if (body)
             {
                 var found = body.bodyIndex == BodyCatalog.FindBodyIndex("LagannBody");
                 if (found)
                 {
                     var gurrenMinionCache = GurrenMinionCache.GetOrSetGurrenStatusCache(x);
                     if (!gurrenMinionCache.gurrenMinion)
                     {
                         return(true);
                     }
                 }
             }
         }
         return(false);
     }))
     {
         TTGL_SurvivorPlugin.instance.Logger.LogMessage("Added Gurren On Level");
         DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(gurrenInteractSpawnCard, new DirectorPlacementRule
         {
             placementMode = DirectorPlacementRule.PlacementMode.Random
         }, self.rng));
     }
     orig(self);
 }
 private bool CanCombine([NotNull] GenericSkill skillSlot)
 {
     var instanceData = ((LagannCombineSkillDef.LagannCombineInstanceData)skillSlot.skillInstanceData);
     if (!instanceData.gurrenMinionCache && skillSlot && skillSlot.characterBody && skillSlot.characterBody.master)
     {
         instanceData.gurrenMinionCache = GurrenMinionCache.GetOrSetGurrenStatusCache(skillSlot.characterBody.master);
     }
     return instanceData.gurrenMinionCache && instanceData.gurrenMinionCache.gurrenMinion;
 }
Example #4
0
        private void RemoveGurren()
        {
            var players           = TeamComponent.GetTeamMembers(TeamIndex.Player);
            var gurrenMinionCache = GurrenMinionCache.GetOrSetGurrenStatusCache(base.characterBody.master);

            if (players != null)
            {
                foreach (var player in players.ToList())
                {
                    if (player.body &&
                        player.body.master &&
                        gurrenMinionCache.gurrenMinion == player.body.master)
                    {
                        var master = player.body.master;
                        master.DestroyBody();
                        NetworkServer.Destroy(master.gameObject);
                        return;
                    }
                }
            }
        }