Exemple #1
0
            private void FireOrb()
            {
                if (this.hasFired)
                {
                    return;
                }
                WispPassiveController.ChargeState chargeState = this.passive.UseCharge(chargeUsed, chargeScaler);
                this.PlayCrossfade("Gesture", "FireBomb", "ChargeBomb.playbackRate", this.duration * (1f - fireDelay), 0.2f);
                this.hasFired = true;
                if (!NetworkServer.active)
                {
                    return;
                }

                Vector3 dir = this.GetAimRay().direction;

                dir.y = 0f;
                dir   = Vector3.Normalize(dir);

                SparkOrb nextOrb = new SparkOrb();

                nextOrb.attacker        = this.gameObject;
                nextOrb.crit            = this.RollCrit();
                nextOrb.damage          = this.damageStat * damageRatio * chargeState.chargeScaler;
                nextOrb.damageColor     = DamageColorIndex.Default;
                nextOrb.direction       = dir;
                nextOrb.origin          = this.GetAimRay().origin;
                nextOrb.procCoef        = 1.0f;
                nextOrb.isFirst         = true;
                nextOrb.radius          = radius;
                nextOrb.scale           = 1.0f;
                nextOrb.speed           = 50.0f;
                nextOrb.stepDist        = 8.0f;
                nextOrb.stepHeight      = 5.0f;
                nextOrb.maxFall         = 25f;
                nextOrb.innerRadScale   = 0.25f;
                nextOrb.edgePenaltyMult = 0.35f;
                nextOrb.stepsLeft       = 1 + (Int32)Math.Truncate(chargeState.chargeConsumed / 7.5);
                nextOrb.team            = TeamComponent.GetObjectTeam(this.gameObject);
                nextOrb.skin            = this.skin;

                OrbManager.instance.AddOrb(nextOrb);
            }
Exemple #2
0
            public override void OnArrival()
            {
                //Explosion effect
                EffectData effect = new EffectData
                {
                    origin      = dest,
                    genericUInt = this.skin
                };

                EffectManager.SpawnEffect(Main.secondaryExplosion, effect, true);

                if (this.attacker)
                {
                    HashSet <HealthComponent> mask = new HashSet <HealthComponent>();
                    HurtBox box;

                    DamageInfo bdmg = new DamageInfo();
                    bdmg.damage           = this.damage;
                    bdmg.attacker         = this.attacker;
                    bdmg.crit             = this.crit;
                    bdmg.damageColorIndex = this.damageColor;
                    bdmg.damageType       = DamageType.Generic;
                    bdmg.force            = (this.direction + Vector3.up) * 50f;
                    bdmg.inflictor        = this.attacker;
                    bdmg.position         = this.dest;
                    bdmg.procChainMask    = this.procMask;
                    bdmg.procCoefficient  = this.procCoef;
                    GlobalEventManager.instance.OnHitAll(bdmg, null);


                    //Collider[] cols = Physics.OverlapCapsule(this.dest, this.dest + new Vector3(0f, 20f, 0f), this.radius * this.innerRadScale, LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal);

                    //foreach( Collider col in cols )
                    //{
                    //    if( !col ) continue;
                    //    box = col.GetComponent<HurtBox>();
                    //    if( !box ) continue;
                    //    HealthComponent hcomp = box.healthComponent;
                    //    if( !hcomp || mask.Contains( hcomp ) || TeamComponent.GetObjectTeam( hcomp.gameObject ) == this.team ) continue;

                    //    DamageInfo dmg = new DamageInfo();
                    //    dmg.damage = this.damage;
                    //    dmg.attacker = this.attacker;
                    //    dmg.crit = this.crit;
                    //    dmg.damageColorIndex = this.damageColor;
                    //    dmg.damageType = DamageType.Generic;
                    //    dmg.force = (this.direction + Vector3.up) * 50f;
                    //    dmg.inflictor = this.attacker;
                    //    dmg.position = col.transform.position;
                    //    dmg.procChainMask = this.procMask;
                    //    dmg.procCoefficient = this.procCoef;

                    //    hcomp.TakeDamage( dmg );
                    //    GlobalEventManager.instance.OnHitEnemy( dmg, hcomp.gameObject );
                    //    GlobalEventManager.instance.OnHitAll( dmg, hcomp.gameObject );
                    //    mask.Add( hcomp );
                    //}

                    var cols = Physics.OverlapCapsule(this.dest, this.dest + new Vector3(0f, 20f, 0f), this.radius, LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal);

                    foreach (Collider col in cols)
                    {
                        if (!col)
                        {
                            continue;
                        }
                        box = col.GetComponent <HurtBox>();
                        if (!box)
                        {
                            continue;
                        }
                        HealthComponent hcomp = box.healthComponent;
                        if (!hcomp || mask.Contains(hcomp) || !FriendlyFireManager.ShouldDirectHitProceed(hcomp, this.team) || hcomp.gameObject == this.attacker)
                        {
                            continue;
                        }

                        DamageInfo dmg = new DamageInfo();
                        dmg.damage           = this.damage;
                        dmg.attacker         = this.attacker;
                        dmg.crit             = this.crit;
                        dmg.damageColorIndex = this.damageColor;
                        dmg.damageType       = DamageType.Generic;
                        dmg.force            = (this.direction + Vector3.up) * 10f;
                        dmg.inflictor        = this.attacker;
                        dmg.position         = col.transform.position;
                        dmg.procChainMask    = this.procMask;
                        dmg.procCoefficient  = this.procCoef * this.edgePenaltyMult;

                        if (this.hitMask.Contains(hcomp))
                        {
                            dmg.damage          *= this.edgePenaltyMult;
                            dmg.procCoefficient *= this.edgePenaltyMult;
                        }

                        hcomp.TakeDamage(dmg);
                        GlobalEventManager.instance.OnHitEnemy(dmg, hcomp.gameObject);
                        GlobalEventManager.instance.OnHitAll(dmg, hcomp.gameObject);
                        mask.Add(hcomp);
                        this.hitMask.Add(hcomp);
                    }
                }

                if (this.stepsLeft > 0 && !this.last)
                {
                    SparkOrb nextOrb = new SparkOrb();
                    nextOrb.maxFall     = this.maxFall;
                    nextOrb.attacker    = this.attacker;
                    nextOrb.crit        = this.crit;
                    nextOrb.damage      = this.damage;
                    nextOrb.damageColor = this.damageColor;
                    nextOrb.direction   = this.direction;
                    nextOrb.origin      = this.dest;
                    nextOrb.procCoef    = this.procCoef;
                    nextOrb.procMask    = this.procMask;
                    nextOrb.isFirst     = false;
                    nextOrb.radius      = this.radius;
                    nextOrb.scale       = this.scale;
                    nextOrb.speed       = this.speed;
                    nextOrb.stepDist    = this.stepDist;
                    nextOrb.stepHeight  = this.stepHeight;
                    nextOrb.stepsLeft   = this.stepsLeft - 1;
                    nextOrb.target      = this.target;
                    nextOrb.team        = this.team;
                    nextOrb.skin        = this.skin;
                    nextOrb.hitMask     = this.hitMask;

                    OrbManager.instance.AddOrb(nextOrb);
                }
            }