Ejemplo n.º 1
0
 // ReSharper disable once IdentifierTypo
 public override void OnHitNPC(NPC target, int damage, float knockBack, bool crit)
 {
     foreach (Action <ProceduralSpellProj, NPC, int> action in Impacts.Where(action => action != null))
     {
         action(this, target, damage);
     }
 }
Ejemplo n.º 2
0
        internal void Initialize(SolutionDependencyContext solutions)
        {
            Solutions = solutions;
            Impacts   = solutions.DependencyTable.Where(r => r.Target != null && r.Target.Solution == Solution)
                        .Select(r => r.Solution)
                        .Distinct()
                        .Select(i => solutions.Solutions.First(d => d.Solution == i))
                        .ToList();
            MinimalImpacts = Impacts.Except(Impacts.SelectMany(r => r.TransitiveImpacts)).ToList();
            var transitive = new HashSet <DependentSolution>(Impacts);

            foreach (var i in Impacts.SelectMany(r => r.TransitiveImpacts))
            {
                transitive.Add(i);
            }
            TransitiveImpacts = transitive;

            ImportedLocalPackages = solutions.PackageDependencies
                                    .Where(d => d.Origin == this)
                                    .Select(d => new ImportedLocalPackage(d))
                                    .ToArray();

            ExportedLocalPackages = solutions.PackageDependencies
                                    .Where(d => d.Target == this)
                                    .Select(d => new ExportedLocalPackage(d))
                                    .ToArray();
        }
Ejemplo n.º 3
0
 public override int GetHashCode()
 {
     return(RecoveryDate.GetHashCode()
            ^ HowDetected.GetHashCode()
            ^ Impacts?.GetHashCode() ?? 0
            ^ OcurrenceDate.GetHashCode()
            ^ RecoverySteps?.GetHashCode() ?? 0
            ^ RootCauses?.GetHashCode() ?? 0
            ^ Symptoms?.GetHashCode() ?? 0
            ^ MonitorName?.GetHashCode() ?? 0);
 }
Ejemplo n.º 4
0
        public override void ReceiveExtraAI(BinaryReader reader)
        {
            projectile.owner = reader.ReadInt32();
            int starType  = reader.ReadInt32();
            int crossType = reader.ReadInt32();
            int moonType  = reader.ReadInt32();

            projectile.damage = reader.ReadInt32();
            bool minionCaster = reader.ReadBoolean();

            Caster = minionCaster ? Main.projectile[reader.ReadInt32()] : (Entity)Main.player[reader.ReadInt32()];
            List <GlyphModifier> modifiers = new List <GlyphModifier>();
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i += 1)
            {
                modifiers.Add(GlyphModifier.Modifiers[reader.ReadInt32()]);
            }
            if (Source == null)
            {
                Source = new ProceduralSpell(mod);
                Source.Glyphs[(byte)GlyphType.Star].SetDefaults(starType, true);
                Source.Glyphs[(byte)GlyphType.Cross].SetDefaults(crossType, true);
                Source.Glyphs[(byte)GlyphType.Moon].SetDefaults(moonType, true);
                Source.ModifierOverride = modifiers;
            }

            foreach (Item item in Source.Glyphs)
            {
                Glyph glyph = (Glyph)item.modItem;
                if (glyph.GetAiAction() != null)
                {
                    Ai.Add(glyph.GetAiAction());
                }
                if (glyph.GetInitAction() != null)
                {
                    Inits.Add(glyph.GetInitAction());
                }
                if (glyph.GetImpactAction() != null)
                {
                    Impacts.Add(glyph.GetImpactAction());
                }
                if (glyph.GetKillAction() != null)
                {
                    Kills.Add(glyph.GetKillAction());
                }
            }

            foreach (GlyphModifier modifier in modifiers)
            {
                if (modifier.Impact != null)
                {
                    Impacts.Add(modifier.Impact);
                }
                if (modifier.Draw != null)
                {
                    SpellDraw.Add(modifier.Draw);
                }
                if (modifier.Init != null)
                {
                    Inits.Add(modifier.Init);
                }
            }

            Initialize();
        }
Ejemplo n.º 5
0
 public virtual void AddImpact(Impacts.IPlantImpact impact)
 {
     if (impact.Apply(this))
         this.Impacts.Add(impact);
 }
Ejemplo n.º 6
0
 public virtual void AddImpact(Impacts.IZombieImpact impact)
 {
     if (impact.Apply(this.CurrentZombieState))
         this.Impacts.Add(impact);
 }