private void RemoveShade(int removedIndex, Shade shade)
 {
     InternalLogger.Debug(LogTag, () => $"RemoveShade( removedIndex: {removedIndex} )");
     shade.PropertyChanged -= ShadePropertyChanged;
     DisposeBitmap(removedIndex);
 }
Esempio n. 2
0
 void Awake()
 {
     int r = Random.Range(0,2);
     //		Debug.Log(r);
     Shade = (Shade)r;
 }
Esempio n. 3
0
 public virtual float pdf(ref Shade s)
 {
     return(1.0f);
 }
 public virtual Color area_light_shade(ref Shade sr)
 {
     return(Constants.black);
 }
 public override Vector3 get_direction(ref Shade s)
 {
     return(Vector3.zero);
 }
Esempio n. 6
0
 public override Color sample_f(ref Shade sr, ref Vector3 wo, ref Vector3 wi, ref float pdf)
 {
     return(Constants.black);
 }
Esempio n. 7
0
 public override Color L(ref Shade s)
 {
     return(materail_ptr.get_le());
 }
Esempio n. 8
0
 public override Color f(ref Shade sr, ref Vector3 wo, ref Vector3 wi)
 {
     return(kd * cd.get_color(ref sr) * Constants.invPI);
 }
 public virtual Color L(ref Shade s)
 {
     return(new Color(0, 0, 0, 1));
 }
 public virtual Vector3  get_direction(ref Shade s)
 {
     return(Vector3.zero);
 }
 public virtual Color f(ref Shade sr, ref Vector3 wo, ref Vector3 wi)
 {
     return(Constants.black);
 }
 public virtual bool tir(ref Shade sr)
 {
     return(false);
 }
 public virtual Color sample_f(ref Shade sr, ref Vector3 wo, ref Vector3 wi, float kr)
 {
     return(Constants.black);
 }
            protected override void OnTick()
            {
                if (m_Item != null)
                {
                    m_Item.IsDigging = false;
                }

                if (!m_From.Alive)
                {
                    m_From.SendMessage("You cannot continue digging in this state.");
                    Stop();
                }
                else
                {
                    if (Utility.Random(100) < 35)
                    {
                        switch (Utility.Random(10))
                        {
                        case 0:
                            Skeleton skel = new Skeleton();
                            skel.Location  = m_From.Location;
                            skel.Map       = m_From.Map;
                            skel.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                skel.IsParagon = true;
                            }

                            World.AddMobile(skel);
                            break;

                        case 1:
                            Ghoul ghoul = new Ghoul();
                            ghoul.Location  = m_From.Location;
                            ghoul.Map       = m_From.Map;
                            ghoul.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                ghoul.IsParagon = true;
                            }

                            World.AddMobile(ghoul);
                            break;

                        case 2:
                            Lich lich = new Lich();
                            lich.Location  = m_From.Location;
                            lich.Map       = m_From.Map;
                            lich.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                lich.IsParagon = true;
                            }

                            World.AddMobile(lich);
                            break;

                        case 3:
                            LichLord lichl = new LichLord();
                            lichl.Location  = m_From.Location;
                            lichl.Map       = m_From.Map;
                            lichl.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                lichl.IsParagon = true;
                            }

                            World.AddMobile(lichl);
                            break;

                        case 4:
                            AncientLich alich = new AncientLich();
                            alich.Location  = m_From.Location;
                            alich.Map       = m_From.Map;
                            alich.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                alich.IsParagon = true;
                            }

                            World.AddMobile(alich);
                            break;

                        case 5:
                            Zombie zom = new Zombie();
                            zom.Location  = m_From.Location;
                            zom.Map       = m_From.Map;
                            zom.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                zom.IsParagon = true;
                            }

                            World.AddMobile(zom);
                            break;

                        case 6:
                            SkeletalKnight sk = new SkeletalKnight();
                            sk.Location  = m_From.Location;
                            sk.Map       = m_From.Map;
                            sk.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                sk.IsParagon = true;
                            }

                            World.AddMobile(sk);
                            break;

                        case 7:
                            SkeletalMage sm = new SkeletalMage();
                            sm.Location  = m_From.Location;
                            sm.Map       = m_From.Map;
                            sm.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                sm.IsParagon = true;
                            }

                            World.AddMobile(sm);
                            break;

                        case 8:
                            Spectre spec = new Spectre();
                            spec.Location  = m_From.Location;
                            spec.Map       = m_From.Map;
                            spec.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                spec.IsParagon = true;
                            }

                            World.AddMobile(spec);
                            break;

                        case 9:
                            Shade shade = new Shade();
                            shade.Location  = m_From.Location;
                            shade.Map       = m_From.Map;
                            shade.Combatant = m_From;

                            if (Utility.Random(100) < 50)
                            {
                                shade.IsParagon = true;
                            }

                            World.AddMobile(shade);
                            break;
                        }
                        m_From.SendMessage("You have angered the spirits.");
                    }
                    else if (m_From.Skills[SkillName.Mining].Base > 10)
                    {
                        if (Utility.Random(120) >= (m_From.Skills[SkillName.Mining].Base))
                        {
                            m_From.SendMessage("You fail to dig anything up.");
                        }
                        else
                        {
                            m_From.SendMessage("You dig up the hideous remains of the demon.  Unfortunately your shovel breaks in the process.");
                            m_From.AddToBackpack(new PumpkinheadRemains());
                            m_Item.Delete();
                        }
                    }
                    else if (m_From.Skills[SkillName.Mining].Base <= 10)
                    {
                        if (Utility.Random(120) > 10)
                        {
                            m_From.SendMessage("You fail to dig anything up.");
                        }
                        else
                        {
                            m_From.SendMessage("You dig up the hideous remains of the demon.  Unfortunately your shovel breaks in the process.");
                            m_From.AddToBackpack(new PumpkinheadRemains());
                            m_Item.Delete();
                        }
                    }
                    else
                    {
                        m_From.SendMessage("You fail to dig anything up.");
                    }

                    Stop();
                }
            }
Esempio n. 15
0
 public override float pdf(ref Shade s)
 {
     return(1.0f);
 }
 public override Vector3 get_direction(ref Shade s)
 {
     return(-dir);
 }
Esempio n. 17
0
 public static byte ShadeToGray(Shade s) => s switch
 {
Esempio n. 18
0
 public override Color rho(ref Shade sr, ref Vector3 wo)
 {
     return(kd * cd.get_color(ref sr));
 }
Esempio n. 19
0
        //TODO: this should have return type void and print messages should queue off events, not a return value
        public bool ExecuteMove(BattleMoveWithTarget battleMoveWithTarget)
        {
            bool     moveSucceeded = false;
            BellMove bellMove      = battleMoveWithTarget.Move as BellMove;

            if (bellMove == null)
            {
                throw new InvalidOperationException($"Bell.ExecuteMove() was erroneously called for a move that was not a Bell move. Movetype: {battleMoveWithTarget.Move.MoveType}");
            }

            Shade targetAsShade = battleMoveWithTarget.Target as Shade;

            if (targetAsShade == null)
            {
                throw new InvalidOperationException($"Bell.ExecuteMove() was given a target that was not a shade! target: {battleMoveWithTarget.Target}");
            }

            int    healthDiff       = targetAsShade.MaxHealth - targetAsShade.CurrentHealth;
            double healthPercentage = ((double)targetAsShade.CurrentHealth) / targetAsShade.MaxHealth;

            double chance = 1.0 / 3;

            if (healthDiff > 0)
            {
                if (healthPercentage < 0.26)
                {
                    chance = 0.8;
                }
                else if (healthPercentage < 0.51)
                {
                    chance = 0.65;
                }
                else if (healthPercentage < 0.76)
                {
                    chance = 0.5;
                }
            }

            if (targetAsShade.ShadeExperience > 1)
            {
                int levelDiff = targetAsShade.ShadeExperience - 1;

                chance -= 0.1 * levelDiff;

                //minimum chance is 10% that it works
                chance = Math.Max(.1, chance);
            }

            if (bellMove.BellMoveType == BellMoveType.ControlMove)
            {
                BattleMoveWithTargetAndNumberInput moveWithNumber = battleMoveWithTarget as BattleMoveWithTargetAndNumberInput;

                if (moveWithNumber == null)
                {
                    throw new InvalidOperationException("Bell.ExecuteMove() should be supplied a BattleMoveWIthTargetAndNUmberInput if the move was a control type Bell move");
                }

                int bloodAmount = moveWithNumber.NumberValue;

                chance += bloodAmount * 0.05;
            }

            if ((BellType == BellType.Silver && bellMove.BellMoveType == BellMoveType.SealMove) ||
                (BellType == BellType.Copper && bellMove.BellMoveType == BellMoveType.ControlMove))
            {
                chance += .25;
            }

            if (ChanceService.EventOccurs(chance))
            {
                int healAmount = targetAsShade.CurrentHealth;
                targetAsShade.Seal();

                moveSucceeded = true;

                if (bellMove.BellMoveType == BellMoveType.SealMove)
                {
                    battleMoveWithTarget.Owner.Heal(healAmount);
                }
                else if (bellMove.BellMoveType == BellMoveType.ControlMove)
                {
                    battleMoveWithTarget.Owner.RaiseMaxHealth(targetAsShade.ShadeExperience);
                }
            }

            return(moveSucceeded);
        }
 public override Color L(ref Shade s)
 {
     return(ls * color);
 }
Esempio n. 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Colour"/> class.
 /// </summary>
 /// <param name="shade">The colour's shade.</param>
 /// <param name="modifier">The shade modifier.</param>
 public Colour(Shade shade, ShadeModifier?modifier)
 {
     this.Shade    = shade;
     this.Modifier = modifier;
 }
Esempio n. 22
0
 public static Boolean IsValidShade(Shade shade)
 {
     return(shade >= Shade.Unshaded && shade <= Shade.Shade8);
 }
Esempio n. 23
0
 public void ToggleShadeForRoundStart()
 {
     roundStart = true;
     Shade.Toggle();
 }
Esempio n. 24
0
 public virtual bool hit(Ray ray, ref float t, ref Shade s)
 {
     t = Mathf.Infinity;
     s = null;
     return(false);
 }
Esempio n. 25
0
 public void ToggleShadeForRoundEnd()
 {
     roundEnd = true;
     Shade.Toggle();
 }
 public virtual Color global_shade(ref Shade sr)
 {
     return(Constants.black);
 }
Esempio n. 27
0
 public void ToggleShadeForMatchEnd()
 {
     matchEnd = true;
     Shade.Toggle();
 }
Esempio n. 28
0
        public void Subscribe(EventType type, IFighter fighter)
        {
            HumanFighter humanFighter   = fighter as HumanFighter;
            Shade        fighterAsShade = fighter as Shade;

            switch (type)
            {
            case EventType.DamageTaken:
                fighter.DamageTaken += _logDamageTaken;
                break;

            case EventType.Healed:
                fighter.Healed += _logHealed;
                break;

            case EventType.MagicalDamageTaken:
                fighter.MagicalDamageTaken += _logMagicalDamageTaken;
                break;

            case EventType.AttackSuccessful:
                fighter.AttackSuccessful += _logAttackSuccessful;
                break;

            case EventType.CriticalAttack:
                fighter.CriticalAttack += _logCriticalAttack;
                break;

            case EventType.AttackMissed:
                fighter.AttackMissed += _logAttackMissed;
                break;

            case EventType.ManaLost:
                fighter.ManaLost += _logManaLost;
                break;

            case EventType.ManaRestored:
                fighter.ManaRestored += _logManaRestored;
                break;

            case EventType.SpellSuccessful:
                fighter.SpellSuccessful += _logSpellSuccessful;
                break;

            case EventType.Killed:
                fighter.Killed += _logKilled;
                break;

            case EventType.EnemyKilled:
                fighter.EnemyKilled += _logEnemyKilled;
                break;

            case EventType.ExpGained:
                if (humanFighter == null)
                {
                    throw new ArgumentException("Only Human Fighters can raise the Exp Gained event!");
                }
                humanFighter.ExpGained += _logExpGained;
                break;

            case EventType.LeveledUp:
                if (humanFighter == null)
                {
                    throw new ArgumentException("Only Human Fighters can raise the Leveled Up event!");
                }
                humanFighter.LeveledUp += _logLeveledUp;
                break;

            case EventType.StatRaised:
                fighter.StatRaised += _logStatRaised;
                break;

            case EventType.StatBonusApplied:
                if (humanFighter == null)
                {
                    throw new ArgumentException("Only Human Fighters can raise the Stat Bonus Applied event!");
                }
                humanFighter.StatBonusApplied += _logStatBonusApplied;
                break;

            case EventType.MagicBonusApplied:
                if (humanFighter == null)
                {
                    throw new ArgumentException("Only Human Fighters can raise the Magic Bonus Applied event!");
                }
                humanFighter.MagicBonusApplied += _logMagicBonusApplied;
                break;

            case EventType.SpellLearned:
                if (humanFighter == null)
                {
                    throw new ArgumentException("Only Human Fighters can raise the Spell Learned event!");
                }
                humanFighter.SpellsLearned += _logSpellLearned;
                break;

            case EventType.MoveLearned:
                if (humanFighter == null)
                {
                    throw new ArgumentException("Only Human Fighters can raise the Move Learned event!");
                }
                humanFighter.MoveLearned += _logMoveLearned;
                break;

            case EventType.TurnEnded:
                fighter.TurnEnded += _logTurnEnded;
                break;

            case EventType.StatusAdded:
                fighter.StatusAdded += _logStatusAdded;
                break;

            case EventType.StatusRemoved:
                fighter.StatusRemoved += _logStatusRemoved;
                break;

            case EventType.AutoEvaded:
                fighter.AutoEvaded += _logAutoEvaded;
                break;

            case EventType.EnemyAttackCountered:
                fighter.EnemyAttackCountered += _logEnemyAttackCountered;
                break;

            case EventType.SpecialMoveExecuted:
                fighter.SpecialMoveExecuted += _logSpecialMoveExecuted;
                break;

            case EventType.SpecialMoveFailed:
                fighter.SpecialMoveFailed += _logSpecialMoveFailed;
                break;

            case EventType.ShieldAdded:
                fighter.ShieldAdded += _logShieldAdded;
                break;

            case EventType.FighterSealed:
                if (fighterAsShade == null)
                {
                    throw new InvalidOperationException("EventLogger.SubScribe() cannot subscribe to event type 'fighter sealed' if the subscribee is not a Shade enemy type");
                }
                fighterAsShade.FighterSealed += _logFighterSealed;
                break;

            case EventType.ShadeAbsorbed:
                if (fighterAsShade == null)
                {
                    throw new InvalidOperationException("EventLogger.SubScribe() cannot subscribe to event type 'fighter sealed' if the subscribee is not a Shade enemy type");
                }
                fighterAsShade.ShadeAbsorbed += _logShadeAbsorbed;
                break;

            case EventType.FighterTransformed:
                if (fighterAsShade == null)
                {
                    throw new InvalidOperationException("EventLogger.Subscribe() cannot subscribe to event type 'fighter transformed' if the subscribee is not a Shade enemy type");
                }
                fighterAsShade.ShadeTransformed += _logFighterTransformed;
                break;

            case EventType.TeamDefeated:
                throw new ArgumentOutOfRangeException(nameof(type), type, "a valid EventType must be specified compatible with IFighters's implemented events");

            case EventType.Ran:
                throw new ArgumentOutOfRangeException(nameof(type), type, "a valid EventType must be specified compatible with IFighters's implemented events");

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, "a valid EventType must be specified compatible with IFighters's implemented events");
            }
        }
Esempio n. 29
0
        public override void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested)
        {
            Map     map = from.Map;
            Point3D loc = from.Location;

            HarvestResource res = vein.PrimaryResource;

            if (res == resource)
            {
                try
                {
                    if (from.Karma > -2459)
                    {
                        Titles.AwardKarma(from, -50, true);
                    }

                    if (Utility.RandomMinMax(1, 100) < 3)                         // CHECK TO SEE IF THEY WERE WITNESSED DIGGING UP A GRAVE 2%
                    {
                        int caught = 1;
                        if (from.Skills[SkillName.Hiding].Value >= 30)
                        {
                            from.SendMessage("Someone passed by, but your stealthiness has avoided you from being seen.");
                            if (from.CheckSkill(SkillName.Stealth, 0, 100))
                            {
                                caught = 0;
                            }
                        }
                        if (caught > 0)
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, 1150, false, "Someone has spotted you in the distance!", from.NetState);
                            from.SendMessage("You have been reported as a criminal!");
                            from.Criminal = true;
                            Server.Items.DisguiseTimers.RemoveDisguise(from);
                        }
                    }

                    map = from.Map;

                    if (map == null)
                    {
                        return;
                    }

                    BaseCreature spawned = new Zombie();

                    switch (Utility.Random(19))
                    {
                    case 0: spawned = new Zombie(); break;

                    case 1: spawned = new Skeleton(); break;

                    case 2: spawned = new Ghoul(); break;

                    case 3: spawned = new Shade(); break;

                    case 4: spawned = new Spectre(); break;

                    case 5: spawned = new Wraith(); break;

                    case 6: spawned = new BoneKnight(); break;

                    case 7: spawned = new BoneMagi(); break;

                    case 8: spawned = new Ghostly(); break;

                    case 9: spawned = new Lich(); break;

                    case 10: spawned = new LichLord(); break;

                    case 11: spawned = new Mummy(); break;

                    case 12: spawned = new RottingCorpse(); break;

                    case 13: spawned = new Shade(); break;

                    case 14: spawned = new SkeletalKnight(); break;

                    case 15: spawned = new SkeletalWizard(); break;

                    case 16: spawned = new SkeletalMage(); break;

                    case 17: spawned = new Phantom(); break;

                    case 18: spawned = new Vampire(); break;
                    }

                    int nSpiritSpeak = (int)(from.Skills[SkillName.SpiritSpeak].Value / 10);

                    string sSaying = "";
                    switch (Utility.Random(9))
                    {
                    case 0: sSaying = "Who has disturbed me!"; break;

                    case 1: sSaying = "You dare steal from my grave?"; break;

                    case 2: sSaying = "Those that take from me will join me!"; break;

                    case 3: sSaying = "Your soul is now mine for the taking!"; break;

                    case 4: sSaying = "Who dares waken me?"; break;

                    case 5: sSaying = "Your life will be extinguished!"; break;

                    case 6: sSaying = "Do you have no respect for the dead?"; break;

                    case 7: sSaying = "I have been waiting to feast off the living!"; break;

                    case 8: sSaying = "Soon you will join my legion of the dead!"; break;
                    }

                    if ((spawned != null) && (Utility.Random(100) > (nSpiritSpeak + 85)))                             // 10% chance you will get a grave raiser
                    {
                        from.CheckSkill(SkillName.SpiritSpeak, 0, 100);
                        int offset = Utility.Random(8) * 2;

                        for (int i = 0; i < m_Offsets.Length; i += 2)
                        {
                            int x = from.X + m_Offsets[(offset + i) % m_Offsets.Length];
                            int y = from.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

                            if (map.CanSpawnMobile(x, y, from.Z))
                            {
                                spawned.OnBeforeSpawn(new Point3D(x, y, from.Z), map);
                                spawned.Home      = new Point3D(x, y, from.Z);
                                spawned.RangeHome = 5;
                                spawned.Title    += " [Awakened]";
                                spawned.MoveToWorld(new Point3D(x, y, from.Z), map);
                                spawned.Say(sSaying);
                                spawned.ControlSlots = 666;
                                spawned.Combatant    = from;
                                return;
                            }
                            else
                            {
                                int z = map.GetAverageZ(x, y);

                                if (map.CanSpawnMobile(x, y, z))
                                {
                                    spawned.OnBeforeSpawn(new Point3D(x, y, z), map);
                                    spawned.Home      = new Point3D(x, y, z);
                                    spawned.RangeHome = 5;
                                    spawned.Title    += " [Awakened]";
                                    spawned.MoveToWorld(new Point3D(x, y, z), map);
                                    spawned.Say(sSaying);
                                    spawned.ControlSlots = 666;
                                    spawned.Combatant    = from;
                                    return;
                                }
                            }
                        }
                        spawned.OnBeforeSpawn(from.Location, from.Map);
                        spawned.Home      = from.Location;
                        spawned.RangeHome = 5;
                        spawned.Title    += " [Awakened]";
                        spawned.MoveToWorld(from.Location, from.Map);
                        spawned.Say(sSaying);
                        spawned.ControlSlots = 666;
                        spawned.Combatant    = from;
                    }

                    int digger = (int)(from.Skills[SkillName.Forensics].Value / 10);
                    if ((2 + digger) > Utility.Random(100))                       // chance to dig up a box
                    {
                        if (from.CheckSkill(SkillName.Forensics, 0, 125))
                        {
                            Item chest = new GraveChest(6, from);
                            switch (Utility.Random(10 + digger))
                            {
                            case 0: chest = new GraveChest(1, from); break;

                            case 1: chest = new GraveChest(1, from); break;

                            case 2: chest = new GraveChest(1, from); break;

                            case 3: chest = new GraveChest(1, from); break;

                            case 4: chest = new GraveChest(1, from); break;

                            case 5: chest = new GraveChest(1, from); break;

                            case 6: chest = new GraveChest(2, from); break;

                            case 7: chest = new GraveChest(2, from); break;

                            case 8: chest = new GraveChest(2, from); break;

                            case 9: chest = new GraveChest(2, from); break;

                            case 10: chest = new GraveChest(2, from); break;

                            case 11: chest = new GraveChest(3, from); break;

                            case 12: chest = new GraveChest(3, from); break;

                            case 13: chest = new GraveChest(3, from); break;

                            case 14: chest = new GraveChest(3, from); break;

                            case 15: chest = new GraveChest(4, from); break;

                            case 16: chest = new GraveChest(4, from); break;

                            case 17: chest = new GraveChest(4, from); break;

                            case 18: chest = new GraveChest(5, from); break;

                            case 19: chest = new GraveChest(5, from); break;
                            }
                            if (chest != null)
                            {
                                chest.MoveToWorld(loc, map);
                                from.SendMessage("you dig up a graveyard chest.");
                            }
                        }
                    }
                }
                catch
                {
                }
            }
        }
Esempio n. 30
0
 public override Color rho(ref Shade sr, ref Vector3 wo)
 {
     return(Constants.black);
 }
Esempio n. 31
0
 public override Color rho(ref Shade sr, ref Vector3 wo)
 {
     return(kd * cd);
 }