コード例 #1
0
        public void SunfireDamage(IntVec3 c)
        {
            List <Thing> tList      = c.GetThingList(this.Map);
            float        baseDamage = 4f * lightPotency * this.arcaneDmg;

            for (int i = 0; i < tList.Count; i++)
            {
                if (tList[i] is Pawn)
                {
                    Pawn           p   = tList[i] as Pawn;
                    BodyPartRecord bpr = p.health.hediffSet.GetRandomNotMissingPart(TMDamageDefOf.DamageDefOf.TM_BurningLight, BodyPartHeight.Undefined, BodyPartDepth.Outside);
                    if (bpr != null)
                    {
                        TM_Action.DamageEntities(tList[i], bpr, baseDamage + pwrVal, .1f * pwrVal, TMDamageDefOf.DamageDefOf.TM_BurningLight, caster);
                    }
                }
                if (tList[i] is Building)
                {
                    TM_Action.DamageEntities(tList[i], null, 4 * (baseDamage + pwrVal), TMDamageDefOf.DamageDefOf.TM_BurningLight, caster);
                }
                if (Rand.Chance(.02f))
                {
                    if (FireUtility.CanEverAttachFire(tList[i]))
                    {
                        FireUtility.TryAttachFire(tList[i], .2f);
                    }
                    else
                    {
                        FireUtility.TryStartFireIn(c, this.Map, .2f);
                    }
                }
            }
        }
コード例 #2
0
        // ######## Tick ######## //

        public override void Tick()
        {
            // Check if a new building is cutting the laser fence.
            if ((Find.TickManager.TicksGame % 30) == 0)
            {
                if (this.Position.GetEdifice() != null)
                {
                    if (pylon != null)
                    {
                        pylon.InformEdificeIsBlocking();
                    }
                }
            }
            // Check if a plant or pawn is in the laser fence path.
            if ((Find.TickManager.TicksGame % 200) == 0)
            {
                List <Thing> thingList = this.Position.GetThingList();
                for (int thingIndex = thingList.Count - 1; thingIndex >= 0; thingIndex--)
                {
                    Thing thing = thingList[thingIndex];
                    if (thing is Plant)
                    {
                        FireUtility.TryStartFireIn(this.Position, 0.1f);
                        break;
                    }
                    if (thing is Pawn)
                    {
                        FireUtility.TryAttachFire(thing, 0.1f);
                        break;
                    }
                }
            }
        }
コード例 #3
0
 // ===================== Main function =====================
 public override void Tick()
 {
     // Check if a new building is cutting the laser fence.
     if (Find.TickManager.TicksGame >= this.nextBuildingCheckTick)
     {
         this.nextBuildingCheckTick = Find.TickManager.TicksGame + buildingCheckPeriodInTicks;
         if (this.Position.GetEdifice(this.Map) != null)
         {
             if (pylon != null)
             {
                 pylon.Notify_EdificeIsBlocking();
             }
         }
     }
     // Check if a plant or pawn is in the laser fence path.
     if (Find.TickManager.TicksGame >= this.nextPlantOrPawnCheckTick)
     {
         this.nextPlantOrPawnCheckTick = Find.TickManager.TicksGame + plantOrPawnCheckPeriodInTick;
         List <Thing> thingList = this.Position.GetThingList(this.Map);
         for (int thingIndex = thingList.Count - 1; thingIndex >= 0; thingIndex--)
         {
             Thing thing = thingList[thingIndex];
             if (thing is Plant)
             {
                 FireUtility.TryStartFireIn(this.Position, this.Map, 0.1f);
                 break;
             }
             if (thing is Pawn)
             {
                 FireUtility.TryAttachFire(thing, 0.1f);
                 break;
             }
         }
     }
 }
コード例 #4
0
        public void DoEffect(Map map)
        {
            List <Pawn> allPawnsSpawned = map.mapPawns.AllPawnsSpawned;

            for (int i = 0; i < allPawnsSpawned.Count; i++)
            {
                Pawn pawn = allPawnsSpawned[i];
                if (CanDamage(pawn, map))
                {
                    FireUtility.TryAttachFire(pawn, 0.4f);
                }
            }

            int count = Rand.Range(4, 7);

            for (int i = 0; i < count; i++)
            {
                if (CellFinderLoose.TryGetRandomCellWith(x => !x.Roofed(map), map, 5000, out IntVec3 result))
                {
                    FireUtility.TryStartFireIn(result, map, 0.7f);
                }
            }
        }