예제 #1
0
        public override void CompPostTick(ref float severityAdjustment)
        {
            base.CompPostTick(ref severityAdjustment);
            bool flag = base.Pawn != null && base.Pawn.Map != null;

            if (flag)
            {
                if (!initialized)
                {
                    initialized = true;
                    this.Initialize();
                }

                if (Find.TickManager.TicksGame > this.nextApplyTick && this.hediffDef != null)
                {
                    Pawn pawn = TM_Calc.FindNearbyFactionPawn(this.Pawn, this.Pawn.Faction, 100);
                    if (pawn != null && pawn.health != null)
                    {
                        if (pawn.health.hediffSet.HasHediff(this.hediffDef, false) || pawn.Faction != this.Pawn.Faction || pawn.RaceProps.Animal)
                        {
                            this.nextApplyTick = Find.TickManager.TicksGame + Rand.Range(80, 150);
                        }
                        else
                        {
                            HealthUtility.AdjustSeverity(pawn, this.hediffDef, 1f);
                            this.nextApplyTick = Find.TickManager.TicksGame + Rand.Range(4800, 5600);
                            MoteMaker.ThrowSmoke(pawn.DrawPos, pawn.Map, 1f);
                            MoteMaker.ThrowLightningGlow(pawn.DrawPos, pawn.Map, .8f);
                            if (this.Pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
                            {
                                CompAbilityUserMight comp = this.Pawn.GetComp <CompAbilityUserMight>();
                                comp.MightUserXP += Rand.Range(10, 15);
                            }
                            else
                            {
                                CompAbilityUserMagic comp = this.Pawn.GetComp <CompAbilityUserMagic>();
                                comp.MagicUserXP += Rand.Range(10, 15);
                            }
                        }
                    }
                }

                if (Find.TickManager.TicksGame % 1200 == 0)
                {
                    DetermineHediff();
                }
            }
        }