Exemple #1
0
    public List <SpellCreationSegment> GetPattern(ISpellGrid grid)
    {
        System.Runtime.Remoting.ObjectHandle handle = System.Activator.CreateInstance(null, pattern);
        ISpellPattern spellPattern = handle.Unwrap() as ISpellPattern;

        return(spellPattern.CreateSpellSegs(grid, damageMod));
    }
Exemple #2
0
 public void calculateValues(ISpellGrid grid, float damage)
 {
     final = true;
     FinalizePixels(grid, damage);
     DetermineSpeed();
     AdjustEventsForSpeed();
 }
Exemple #3
0
    public List <SpellCreationSegment> CreateSpellSegs(ISpellGrid grid, float damageMod)
    {
        SpellCreationSegment seg = new SpellCreationSegment();

        seg.AddEvent(new Wait(.15f, seg));
        seg.AddEvent(new SpellEnd());

        SpellCreationSegment seg1 = new SpellCreationSegment();

        seg1.AddEvent(new Wait(.15f, seg));
        seg1.AddEvent(new SpellEnd());
        seg1.SetStartingRotation(-12);

        SpellCreationSegment seg2 = new SpellCreationSegment();

        seg2.AddEvent(new Wait(.15f, seg));
        seg2.AddEvent(new SpellEnd());
        seg2.SetStartingRotation(12);

        List <SpellCreationSegment> segs = new List <SpellCreationSegment>();

        segs.Add(seg);
        segs.Add(seg1);
        segs.Add(seg2);

        return(segs);
    }
Exemple #4
0
    public List <SpellCreationSegment> CreateSpellSegs(ISpellGrid grid, float damageMod)
    {
        SpellCreationSegment seg = new SpellCreationSegment();

        seg.AddEvent(new Wait(40, seg));
        seg.AddEvent(new SpellEnd());
        List <SpellCreationSegment> segs = new List <SpellCreationSegment> ();

        segs.Add(seg);
        return(segs);
    }
Exemple #5
0
    public List <SpellCreationSegment> CreateSpellSegs(ISpellGrid grid, float damageMod)
    {
        List <SpellCreationSegment> segs = new List <SpellCreationSegment> ();

        for (int i = 0; i < 8; i++)
        {
            SpellCreationSegment seg = new SpellCreationSegment();
            seg.SetSpeedMod(.5f);
            seg.SetStartingRotation(i * 45);
            seg.AddEvent(new Wait(7, seg));
            seg.AddEvent(new SpellEnd());
            segs.Add(seg);
        }
        return(segs);
    }
Exemple #6
0
    public List <SpellCreationSegment> CreateSpellSegs(ISpellGrid grid, float damageMod)
    {
        List <SpellCreationSegment> segs = new List <SpellCreationSegment>();

        for (int i = 0; i < 4; i++)
        {
            SpellCreationSegment seg = new SpellCreationSegment();
            seg.SetStartingRotation((5 * i) - Random.Range(10, 40));
            seg.AddEvent(new SpellMove(Random.Range(0, 2), seg));
            seg.AddEvent(new Wait(12, seg));
            seg.AddEvent(new SpellEnd());
            segs.Add(seg);
        }
        return(segs);
    }
Exemple #7
0
    public List <SpellCreationSegment> CreateSpellSegs(ISpellGrid grid, float damageMod)
    {
        SpellCreationSegment seg = new SpellCreationSegment();

        seg.SetStartingRotation(0);
        seg.SetTurnSpeed(200);

        seg.AddEvent(new Wait(8f, seg));
        seg.AddEvent(new Turn(-160, seg));
        seg.AddEvent(new Wait(9f, seg));
        seg.AddEvent(new SpellEnd());
        List <SpellCreationSegment> segs = new List <SpellCreationSegment>();

        segs.Add(seg);
        return(segs);
    }
Exemple #8
0
 void FinalizePixels(ISpellGrid grid, float damage)
 {
     if (!makePixels)
     {
         return;
     }
     ISpellPixel[,] pixels = grid.GetGrid();
     for (int x = 0; x < pixels.GetLength(0); x++)
     {
         for (int y = 0; y < pixels.GetLength(1); y++)
         {
             if (pixels[x, y].IsActive())
             {
                 SpellPixelFinal finalPix = new SpellPixelFinal(pixels[x, y].GetInk(), new Vector2(y - pixels.GetLength(1) / 2, x - pixels.GetLength(0) / 2));
                 finalPix.damage = finalPix.m_ink.GetDamageMod() * damage;
                 spellPixels.Add(finalPix);
             }
         }
     }
 }
Exemple #9
0
    public SpellBook SpellBookRain(ISpellGrid fgrid)
    {
        NonMonoSpellGrid grid = new NonMonoSpellGrid(6, 6);
        Ink ink = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("FireWeedSap", SpellComponent.SubSpellComponentType.Ink)) as Ink;

        grid.SetInk(ink);
        grid.SetPixel(2, 2, true);
        grid.SetPixel(2, 3, true);
        grid.SetPixel(2, 4, true);


        ProjectileSpellBookBuilder spellBuilder = new ProjectileSpellBookBuilder(ProjectileSpellBookBuilder.spellSource.player);

        //spellBuilder.caster = ;
        spellBuilder.grid = grid;
        spellBuilder.page = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Paper", SpellComponent.SubSpellComponentType.Paper)) as SpellPage;
        spellBuilder.lang = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("English", SpellComponent.SubSpellComponentType.language)) as Language;
        spellBuilder.SetRune(ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Raging Badger", SpellComponent.SubSpellComponentType.Rune)) as SpellRune);
        return(spellBuilder.MakeSpellBook());
    }
Exemple #10
0
    public float GetTotalDamage(float runeDamage, float pageDamage, ISpellGrid grid)
    {
        float totalDmg = 0;

        // Add up the cost of each pixel
        foreach (KeyValuePair <Ink, int> entry in grid.GetInkToNumberOfActiveInksOfThatType())
        {
            totalDmg += (entry.Key.GetDamageMod() + runeDamage + pageDamage) * entry.Value / 3;
        }

        // Add up the cost of other spells this segment is casting
        foreach (SpellEvent sEvent in events)
        {
            if (sEvent is SpellCastEvent)
            {
                SpellCastEvent sce = (SpellCastEvent)sEvent;
                //totalDmg += sce.spell.cost;
            }
        }
        return(totalDmg);
    }
Exemple #11
0
    public float GetCost(float runeCost, float pageCost, ISpellGrid grid)
    {
        float totalCost = 0;

        // Add up the cost of each pixel

        foreach (KeyValuePair <Ink, int> entry in grid.GetInkToNumberOfActiveInksOfThatType())
        {
            totalCost += (entry.Key.GetCost() + pageCost) * runeCost * entry.Value;
        }

        // Add up the cost of other spells this segment is casting
        foreach (SpellEvent sEvent in events)
        {
            if (sEvent is SpellCastEvent)
            {
                SpellCastEvent sce = (SpellCastEvent)sEvent;
                totalCost += sce.spell.cost;
            }
        }
        return(totalCost);
    }
Exemple #12
0
    public List <SpellCreationSegment> CreateSpellSegs(ISpellGrid grid, float damageMod)
    {
        List <SpellCreationSegment> segs = new List <SpellCreationSegment> ();

        for (int i = 0; i < 8; i++)
        {
            SpellCreationSegment seg = new SpellCreationSegment();
            seg.SetStartingRotation(i * 360 / 8);
            seg.SetTurnSpeed(100);

            //seg.AddEvent(new SpellMove(1, seg));
            seg.AddEvent(new Wait(2, seg));
            seg.AddEvent(new SpeedChange(.01f, seg));
            seg.AddEvent(new Turn(90, seg));
            seg.AddEvent(new Wait(5, seg));
            seg.AddEvent(new SpeedChange(1, seg));
            seg.AddEvent(new Wait(20, seg));
            seg.AddEvent(new SpellEnd());
            segs.Add(seg);
        }
        return(segs);
    }
Exemple #13
0
    public List <SpellCreationSegment> CreateSpellSegs(ISpellGrid grid, float damageMod)
    {
        List <SpellCreationSegment> segs = new List <SpellCreationSegment>();

        for (int i = 0; i < 7; i++)
        {
            SpellCreationSegment seg = new SpellCreationSegment();

            float sign = -1;
            if (51 * i > 180)
            {
                sign = 1;
            }

            seg.SetStartingRotation(51 * i);
            seg.AddEvent(new Turn(51 * i * sign, seg));
            seg.AddEvent(new Wait(20, seg));
            seg.AddEvent(new SpellEnd());
            seg.SetTurnSpeed(300);
            segs.Add(seg);
        }
        return(segs);
    }
Exemple #14
0
    public List <SpellCreationSegment> CreateSpellSegs(ISpellGrid grid, float damageMod)
    {
        List <SpellCreationSegment> segs = new List <SpellCreationSegment>();
        Vector2 maxRange = new Vector2(2.1f, 2.1f);
        Vector2 minRange = new Vector2(-2.1f, -2.1f);

        SpellBook            book = SpellBookRain(grid);
        SpellCreationSegment seg  = new SpellCreationSegment();

        seg.makePixels = false;

        seg.AddEvent(new SpeedChange(.001f, seg));
        seg.AddEvent(new SpellFaceEvent(new Vector3(0, 0, -90), seg));
        for (int i = 0; i < 8; i++)
        {
            seg.AddEvent(new SpellCastEvent(book, minRange, maxRange));
            seg.AddEvent(new Wait(0.25f, 1f, seg));
        }
        seg.AddEvent(new SpellEnd());
        segs.Add(seg);

        return(segs);
    }
Exemple #15
0
 public NonMonoSpellPixel(ISpellGrid sg)
 {
     grid = sg;
 }
Exemple #16
0
 public void SetSpellGrid(ISpellGrid sg)
 {
     grid = sg;
 }