コード例 #1
0
 public override IEnumerable <PreCastAction> GetPreCastActions()
 {
     yield return(new PreCastAction
     {
         action = delegate(LocalTargetInfo t, LocalTargetInfo d)
         {
             if (!parent.def.HasAreaOfEffect)
             {
                 Pawn pawn = t.Pawn;
                 if (pawn != null)
                 {
                     MoteMaker.MakeAttachedOverlay(pawn, ThingDefOf.Mote_PsycastSkipFlashEntry, Vector3.zero).detachAfterTicks = 5;
                 }
                 else
                 {
                     MoteMaker.MakeStaticMote(t.CenterVector3, parent.pawn.Map, ThingDefOf.Mote_PsycastSkipFlashEntry);
                 }
                 MoteMaker.MakeStaticMote(d.Cell, parent.pawn.Map, ThingDefOf.Mote_PsycastSkipInnerExit);
             }
             if (Props.destination != AbilityEffectDestination.RandomInRange)
             {
                 MoteMaker.MakeStaticMote(d.Cell, parent.pawn.Map, ThingDefOf.Mote_PsycastSkipOuterRingExit);
             }
             if (!parent.def.HasAreaOfEffect)
             {
                 SoundDefOf.Psycast_Skip_Entry.PlayOneShot(new TargetInfo(t.Cell, parent.pawn.Map));
                 SoundDefOf.Psycast_Skip_Exit.PlayOneShot(new TargetInfo(d.Cell, parent.pawn.Map));
             }
         },
         ticksAwayFromCast = 5
     });
 }
コード例 #2
0
 public override void DoEffectOn(Pawn user, Thing target)
 {
     if (Props.moteDef != null)
     {
         MoteMaker.MakeAttachedOverlay(target, Props.moteDef, Vector3.zero);
     }
 }
コード例 #3
0
 protected void MeditationTick()
 {
     pawn.skills.Learn(SkillDefOf.Intellectual, 0.0180000011f);
     pawn.GainComfortFromCellIfPossible();
     if (pawn.needs.joy != null)
     {
         JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.None);
     }
     if (pawn.IsHashIntervalTick(100))
     {
         MoteMaker.ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Meditating);
     }
     if (!ModsConfig.RoyaltyActive)
     {
         return;
     }
     pawn.psychicEntropy.Notify_Meditated();
     if (pawn.HasPsylink && pawn.psychicEntropy.PsychicSensitivity > float.Epsilon)
     {
         if (psyfocusMote == null || psyfocusMote.Destroyed)
         {
             psyfocusMote = MoteMaker.MakeAttachedOverlay(pawn, ThingDefOf.Mote_PsyfocusPulse, Vector3.zero);
         }
         psyfocusMote.Maintain();
         if (sustainer == null || sustainer.Ended)
         {
             sustainer = SoundDefOf.MeditationGainPsyfocus.TrySpawnSustainer(SoundInfo.InMap(pawn, MaintenanceType.PerTick));
         }
         sustainer.Maintain();
         pawn.psychicEntropy.GainPsyfocus(Focus.Thing);
     }
 }
コード例 #4
0
ファイル: Psycast.cs プロジェクト: KraigXu/GameProject
 public override void QueueCastingJob(LocalTargetInfo target, LocalTargetInfo destination)
 {
     base.QueueCastingJob(target, destination);
     if (moteCast == null || moteCast.Destroyed)
     {
         moteCast = MoteMaker.MakeAttachedOverlay(pawn, ThingDefOf.Mote_CastPsycast, MoteCastOffset, MoteCastScale, base.verb.verbProps.warmupTime - MoteCastFadeTime);
     }
 }
コード例 #5
0
 private void SpawnMote(LocalTargetInfo target, ThingDef def)
 {
     if (target.HasThing)
     {
         MoteMaker.MakeAttachedOverlay(target.Thing, def, Vector3.zero, Props.scale);
     }
     else
     {
         MoteMaker.MakeStaticMote(target.Cell, parent.pawn.Map, def, Props.scale);
     }
 }
コード例 #6
0
 public virtual void DoEffect(Pawn usedBy)
 {
     if (usedBy.Map == Find.CurrentMap)
     {
         if (Props.doCameraShake && usedBy.Spawned)
         {
             Find.CameraDriver.shaker.DoShake(1f);
         }
         if (Props.moteOnUsed != null)
         {
             MoteMaker.MakeAttachedOverlay(usedBy, Props.moteOnUsed, Vector3.zero, Props.moteOnUsedScale);
         }
     }
 }
コード例 #7
0
 public override IEnumerable <PreCastAction> GetPreCastActions()
 {
     yield return(new PreCastAction
     {
         action = delegate
         {
             foreach (Pawn item in PawnsToSkip())
             {
                 MoteMaker.MakeAttachedOverlay(item, ThingDefOf.Mote_PsycastSkipFlashEntry, Vector3.zero).detachAfterTicks = 5;
             }
         },
         ticksAwayFromCast = 5
     });
 }
コード例 #8
0
 public override void AbilityTick()
 {
     base.AbilityTick();
     if (pawn.Spawned && base.Casting)
     {
         if (moteCast == null || moteCast.Destroyed)
         {
             moteCast = MoteMaker.MakeAttachedOverlay(pawn, ThingDefOf.Mote_CastPsycast, MoteCastOffset, MoteCastScale, base.verb.verbProps.warmupTime - MoteCastFadeTime);
         }
         else
         {
             moteCast.Maintain();
         }
     }
 }
コード例 #9
0
        public virtual void Apply(LocalTargetInfo target, LocalTargetInfo dest)
        {
            if (Props.screenShakeIntensity > float.Epsilon)
            {
                Find.CameraDriver.shaker.DoShake(Props.screenShakeIntensity);
            }
            Pawn pawn  = parent.pawn;
            Pawn pawn2 = target.Pawn;

            if (pawn2 != null)
            {
                Faction factionOrExtraHomeFaction = pawn2.FactionOrExtraHomeFaction;
                if (Props.goodwillImpact != 0 && pawn.Faction != null && factionOrExtraHomeFaction != null && !factionOrExtraHomeFaction.HostileTo(pawn.Faction) && (Props.applyGoodwillImpactToLodgers || !pawn2.IsQuestLodger()) && !pawn2.IsQuestHelper())
                {
                    factionOrExtraHomeFaction.TryAffectGoodwillWith(pawn.Faction, Props.goodwillImpact, canSendMessage: true, canSendHostilityLetter: true, "GoodwillChangedReason_UsedAbility".Translate(parent.def.LabelCap, pawn2.LabelShort), pawn2);
                }
            }
            ThingDef moteDef = (!Props.psychic) ? ThingDefOf.Mote_PsycastSkipEffect : ThingDefOf.Mote_PsycastPsychicEffect;

            if (target.HasThing)
            {
                MoteMaker.MakeAttachedOverlay(target.Thing, moteDef, Vector3.zero);
            }
            else
            {
                MoteMaker.MakeStaticMote(target.Cell, parent.pawn.Map, moteDef);
            }
            if (Props.clamorType != null)
            {
                GenClamor.DoClamor(parent.pawn, target.Cell, Props.clamorRadius, Props.clamorType);
            }
            if (Props.sound != null)
            {
                Props.sound.PlayOneShot(new TargetInfo(target.Cell, parent.pawn.Map));
            }
            if (!Props.message.NullOrEmpty())
            {
                Messages.Message(Props.message, parent.pawn, Props.messageType ?? MessageTypeDefOf.SilentInput);
            }
        }
コード例 #10
0
 public void PsychicEntropyTrackerTick()
 {
     if (currentEntropy > float.Epsilon)
     {
         currentEntropy = Mathf.Max(currentEntropy - 1.TicksToSeconds() * RecoveryRate, 0f);
     }
     if (currentEntropy > float.Epsilon && !pawn.health.hediffSet.HasHediff(HediffDefOf.PsychicEntropy))
     {
         pawn.health.AddHediff(HediffDefOf.PsychicEntropy);
     }
     if (currentEntropy > float.Epsilon)
     {
         if (ticksSinceLastMote >= TicksBetweenMotes[(int)Severity])
         {
             if (pawn.Spawned)
             {
                 MoteMaker.MakeAttachedOverlay(pawn, ThingDefOf.Mote_EntropyPulse, Vector3.zero);
             }
             ticksSinceLastMote = 0;
         }
         else
         {
             ticksSinceLastMote++;
         }
     }
     else
     {
         ticksSinceLastMote = 0;
     }
     if (NeedsPsyfocus && pawn.IsHashIntervalTick(150))
     {
         float num = 400f;
         if (!IsCurrentlyMeditating)
         {
             currentPsyfocus = Mathf.Clamp(currentPsyfocus - PsyfocusFallPerDay / num, 0f, 1f);
         }
         MeditationUtility.CheckMeditationScheduleTeachOpportunity(pawn);
     }
 }
コード例 #11
0
ファイル: CompTargetable.cs プロジェクト: KraigXu/GameProject
 public override void DoEffect(Pawn usedBy)
 {
     if ((!PlayerChoosesTarget || target != null) && (target == null || GetTargetingParameters().CanTarget(target)))
     {
         base.DoEffect(usedBy);
         foreach (Thing target2 in GetTargets(target))
         {
             foreach (CompTargetEffect comp in parent.GetComps <CompTargetEffect>())
             {
                 comp.DoEffectOn(usedBy, target2);
             }
             if (Props.moteOnTarget != null)
             {
                 MoteMaker.MakeAttachedOverlay(target2, Props.moteOnTarget, Vector3.zero);
             }
             if (Props.moteConnecting != null)
             {
                 MoteMaker.MakeConnectingLine(usedBy.DrawPos, target2.DrawPos, Props.moteConnecting, usedBy.Map);
             }
         }
         target = null;
     }
 }