Esempio n. 1
0
        public virtual void Effect()
        {
            CompAbilityUserMagic comp = CasterPawn.TryGetComp <CompAbilityUserMagic>();

            if (comp.SoL != null)
            {
                comp.SoL.shouldDismiss = true;
            }
            else
            {
                LocalTargetInfo t    = this.TargetsAoE[0];
                bool            flag = t.Cell != default(IntVec3);
                if (flag)
                {
                    Thing sol = new Thing();
                    sol.def = TorannMagicDefOf.FlyingObject_SpiritOfLight;

                    LongEventHandler.QueueLongEvent(delegate
                    {
                        FlyingObject_SpiritOfLight flyingObject = (FlyingObject_SpiritOfLight)GenSpawn.Spawn(ThingDef.Named("FlyingObject_SpiritOfLight"), this.CasterPawn.Position, this.CasterPawn.Map);
                        flyingObject.Launch(this.CasterPawn, t.Cell, sol);
                        flyingObject.shouldDismiss = false;
                        comp.SoL = flyingObject;
                    }, "LaunchingFlyer", false, null);
                }
            }
        }
Esempio n. 2
0
        protected override bool TryCastShot()
        {
            bool flag = false;

            this.TargetsAoE.Clear();
            this.UpdateTargets();
            int  shotsPerBurst = this.ShotsPerBurst;
            bool flag2         = this.UseAbilityProps.AbilityTargetCategory != AbilityTargetCategory.TargetAoE && this.TargetsAoE.Count > 1;

            if (flag2)
            {
                this.TargetsAoE.RemoveRange(0, this.TargetsAoE.Count - 1);
            }
            bool flag3 = this.UseAbilityProps.mustHaveTarget && this.TargetsAoE.Count == 0;
            bool result;

            if (flag3)
            {
                Messages.Message("AU_NoTargets".Translate(), MessageTypeDefOf.RejectInput, true);
                this.Ability.Notify_AbilityFailed(true);
                result = false;
            }
            else
            {
                for (int i = 0; i < this.TargetsAoE.Count; i++)
                {
                    Thing glyph = ThingMaker.MakeThing(RWBYDefOf.Weiss_Glyph_Summon);
                    glyph.TryGetComp <CompGlyphSummon>().SetData(GenTicks.SecondsToTicks(1.5f), RWBYDefOf.Grimm_ArmaGigas_Summoned);
                    GenSpawn.Spawn(glyph, TargetsAoE[i].Cell, caster.Map);
                    CasterPawn.TryGetComp <CompAbilityUserAura>().AbilityData.AllPowers.Find(a => a.Def == RWBYDefOf.Weiss_SummonArmaGigas).CooldownTicksLeft      = 3600;
                    CasterPawn.TryGetComp <CompAbilityUserAura>().AbilityData.AllPowers.Find(a => a.Def == RWBYDefOf.Weiss_SummonArmaGigasSword).CooldownTicksLeft = 3600;
                    bool abilitySucceeded = true;
                    if (abilitySucceeded)
                    {
                        flag = true;
                    }
                }
                this.PostCastShot(flag, out flag);
                bool postSucceed = !flag;
                if (postSucceed)
                {
                    this.Ability.Notify_AbilityFailed(this.UseAbilityProps.refundsPointsAfterFailing);
                }
                result = flag;
            }
            return(result);
        }
        protected override bool TryCastShot()
        {
            bool flag = false;

            this.TargetsAoE.Clear();
            this.UpdateTargets();
            int  shotsPerBurst = this.ShotsPerBurst;
            bool flag2         = this.UseAbilityProps.AbilityTargetCategory != AbilityTargetCategory.TargetAoE && this.TargetsAoE.Count > 1;

            if (flag2)
            {
                this.TargetsAoE.RemoveRange(0, this.TargetsAoE.Count - 1);
            }
            bool flag3 = this.UseAbilityProps.mustHaveTarget && this.TargetsAoE.Count == 0;
            bool result;

            if (flag3)
            {
                Messages.Message("AU_NoTargets".Translate(), MessageTypeDefOf.RejectInput, true);
                this.Ability.Notify_AbilityFailed(true);
                result = false;
            }
            else
            {
                for (int i = 0; i < this.TargetsAoE.Count; i++)
                {
                    ((Aura_Blake)CasterPawn.TryGetComp <CompAbilityUserAura>().aura).SetClone(RWBYDefOf.Blake_ShadowClone_Stone, 10f, new Color(0.5f, 0.5f, 0.5f));
                    bool abilitySucceeded = true;
                    if (abilitySucceeded)
                    {
                        flag = true;
                    }
                }
                this.PostCastShot(flag, out flag);
                bool postSucceed = !flag;
                if (postSucceed)
                {
                    this.Ability.Notify_AbilityFailed(this.UseAbilityProps.refundsPointsAfterFailing);
                }
                result = flag;
            }
            return(result);
        }
        // Token: 0x060039DF RID: 14815 RVA: 0x001B80A4 File Offset: 0x001B64A4
        protected override DamageWorker.DamageResult ApplyMeleeDamageToTarget(LocalTargetInfo target)
        {
            DamageWorker.DamageResult result = new DamageWorker.DamageResult();
            Pawn hitPawn = (Pawn)target;

            if (infect && !XenomorphUtil.IsInfectedPawn(hitPawn) && !hitPawn.Dead && hitPawn.RaceProps.body.AllParts.Any(x => x.def.defName.Contains("Head")))
            {
                foreach (var part in hitPawn.RaceProps.body.AllParts.Where(x => x.def.defName.Contains("Head")))
                {
                    Hediff                    hediff      = HediffMaker.MakeHediff(XenomorphDefOf.RRY_FaceHuggerInfection, hitPawn, null);
                    Comp_Facehugger           _Facehugger = CasterPawn.TryGetComp <Comp_Facehugger>();
                    HediffComp_XenoFacehugger comp        = hediff.TryGetComp <HediffComp_XenoFacehugger>();
                    comp.instigator            = CasterPawn;
                    comp.instigatorKindDef     = CasterPawn.kindDef;
                    comp.royaleHugger          = _Facehugger.RoyaleHugger;
                    comp.previousImpregnations = _Facehugger.Impregnations;
                    hitPawn.health.AddHediff(hediff, part, null);
                    string text = TranslatorFormattedStringExtensions.Translate("Xeno_Facehugger_Attach", hitPawn.LabelShort, part.LabelShortCap);
                    MoteMaker.ThrowText(hitPawn.Position.ToVector3(), hitPawn.Map, text, 5f);
                    comp.GetDirectlyHeldThings();
                    caster.DeSpawn();
                    infect = false;
                }
            }
            else
            {
                foreach (DamageInfo dinfo in this.DamageInfosToApply(target))
                {
                    if (target.ThingDestroyed)
                    {
                        break;
                    }
                    result = target.Thing.TakeDamage(dinfo);
                }
            }
            return(result);
        }
Esempio n. 5
0
        protected override bool TryCastShot()
        {
            bool flag = false;

            this.TargetsAoE.Clear();
            this.UpdateTargets();
            int  shotsPerBurst = this.ShotsPerBurst;
            bool flag2         = this.UseAbilityProps.AbilityTargetCategory != AbilityTargetCategory.TargetAoE && this.TargetsAoE.Count > 1;

            if (flag2)
            {
                this.TargetsAoE.RemoveRange(0, this.TargetsAoE.Count - 1);
            }
            bool flag3 = this.UseAbilityProps.mustHaveTarget && this.TargetsAoE.Count == 0;
            bool result;

            if (flag3)
            {
                Messages.Message("AU_NoTargets".Translate(), MessageTypeDefOf.RejectInput, true);
                this.Ability.Notify_AbilityFailed(true);
                result = false;
            }
            else
            {
                for (int i = 0; i < this.TargetsAoE.Count; i++)
                {
                    bool abilitySucceeded = true;
                    if (TargetsAoE[i].Thing != null && TargetsAoE[i].Thing is Pawn targetPawn)
                    {
                        float damageToDeal = ((Aura_Adam)CasterPawn.TryGetComp <CompAbilityUserAura>().aura).absorbedDamage;
                        if (targetPawn.TryGetComp <CompAbilityUserAura>() is CompAbilityUserAura compAbilityUserAura && targetPawn.TryGetComp <CompAbilityUserAura>().IsInitialized&& compAbilityUserAura.aura.currentEnergy > 0f)
                        {
                            float damageToDealToAura = 0f;
                            if (compAbilityUserAura.aura.currentEnergy > damageToDeal)
                            {
                                damageToDealToAura = damageToDeal;
                                damageToDeal       = 0;
                            }
                            else
                            {
                                damageToDealToAura = compAbilityUserAura.aura.currentEnergy * 100f + 1f;
                                damageToDeal       = damageToDeal - compAbilityUserAura.aura.currentEnergy;
                            }
                            DamageInfo extraDinfoToAura = new DamageInfo(DamageDefOf.Cut, damageToDealToAura, 0f, -1f, CasterPawn, null, CasterPawn.def, DamageInfo.SourceCategory.ThingOrUnknown, targetPawn);
                            extraDinfoToAura.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside);
                            Vector3 direction = (targetPawn.Position - CasterPawn.Position).ToVector3();
                            extraDinfoToAura.SetAngle(direction);
                            targetPawn.TakeDamage(extraDinfoToAura);
                        }
                        if (damageToDeal > 0)
                        {
                            DamageInfo extraDinfo = new DamageInfo(DamageDefOf.Cut, damageToDeal, 0f, -1f, CasterPawn, null, CasterPawn.def, DamageInfo.SourceCategory.ThingOrUnknown, targetPawn);
                            extraDinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside);
                            Vector3 direction = (targetPawn.Position - CasterPawn.Position).ToVector3();
                            extraDinfo.SetAngle(direction);
                            targetPawn.TakeDamage(extraDinfo);
                        }
                        Projectile projectile = (Projectile)GenSpawn.Spawn(RWBYDefOf.RWBY_Ability_Adam_Projectile, CasterPawn.Position, CasterPawn.Map, WipeMode.Vanish);
                        projectile.Launch(CasterPawn, targetPawn, targetPawn, ProjectileHitFlags.IntendedTarget);
                        ((Aura_Adam)CasterPawn.TryGetComp <CompAbilityUserAura>().aura).absorbedDamage = 1f;
                    }
                    else
                    {
                        abilitySucceeded = false;
                    }
                    if (abilitySucceeded)
                    {
                        flag = true;
                    }
                }
                this.PostCastShot(flag, out flag);
                bool postSucceed = !flag;
                if (postSucceed)
                {
                    this.Ability.Notify_AbilityFailed(this.UseAbilityProps.refundsPointsAfterFailing);
                }
                result = flag;
            }
            return(result);
        }
        protected override bool TryCastShot()
        {
            bool flag = false;

            this.TargetsAoE.Clear();
            this.UpdateTargets();
            int  shotsPerBurst = this.ShotsPerBurst;
            bool flag2         = this.UseAbilityProps.AbilityTargetCategory != AbilityTargetCategory.TargetAoE && this.TargetsAoE.Count > 1;

            if (flag2)
            {
                this.TargetsAoE.RemoveRange(0, this.TargetsAoE.Count - 1);
            }
            bool flag3 = this.UseAbilityProps.mustHaveTarget && this.TargetsAoE.Count == 0;
            bool result;

            if (flag3)
            {
                Messages.Message("AU_NoTargets".Translate(), MessageTypeDefOf.RejectInput, true);
                this.Ability.Notify_AbilityFailed(true);
                result = false;
            }
            else
            {
                for (int i = 0; i < this.TargetsAoE.Count; i++)
                {
                    bool abilitySucceeded = true;
                    if (TargetsAoE[i].Thing != null && TargetsAoE[i].Thing is Pawn targetPawn && CasterPawn.TryGetComp <CompAbilityUserAura>().aura is Aura_Raven aura_Raven)
                    {
                        abilitySucceeded = aura_Raven.RegisterBondedPawn(targetPawn);
                    }
                    if (abilitySucceeded)
                    {
                        flag = true;
                    }
                }
                this.PostCastShot(flag, out flag);
                bool postSucceed = !flag;
                if (postSucceed)
                {
                    this.Ability.Notify_AbilityFailed(this.UseAbilityProps.refundsPointsAfterFailing);
                }
                result = flag;
            }
            return(result);
        }