Esempio n. 1
0
    public override void DoDamage()
    {
        base.DoDamage();
        Alchemist alchemist = EnemyBase as Alchemist;

        alchemist.SetAlchemistScreen();
    }
Esempio n. 2
0
        //wybieranie zasobów z fabryk przez alchemika
        private bool checkResourcesAlchemist(Alchemist alchemist)
        {
            resourcesMutex.WaitOne();
            bool isSulfur  = resourceCount[(int)Resource.Sulfur] > 0;
            bool isLead    = resourceCount[(int)Resource.Lead] > 0;
            bool isMercury = resourceCount[(int)Resource.Mercury] > 0;

            if (resourceCount[(int)Resource.Sulfur] < 0 || resourceCount[(int)Resource.Lead] < 0 ||
                resourceCount[(int)Resource.Mercury] < 0)
            {
                throw new Exception("Zasoby < 0 !");
            }

            if ((alchemist == Alchemist.AlchemistA && isMercury && isLead) ||
                (alchemist == Alchemist.AlchemistB && isSulfur && isMercury) ||
                (alchemist == Alchemist.AlchemistC && isLead && isSulfur) ||
                (alchemist == Alchemist.AlchemistD && isLead && isSulfur && isMercury))
            {
                acquireResources(alchemist);
                resourcesMutex.Release();
                return(true);
            }

            resourcesMutex.Release();
            return(false);
        }
Esempio n. 3
0
        private void changeAlchemistNumber(Alchemist alchemist, int addNumber)
        {
            int alchemistNumber = (int)alchemist;

            alchemistCountMutexes[alchemistNumber].WaitOne();
            alchemistCount[alchemistNumber] += addNumber;
            alchemistCountMutexes[alchemistNumber].Release();
        }
 override public void Enter(Alchemist alchemist)
 {
     if (alchemist.m_location != Location.Forest)
     {
         alchemist.m_location = Location.Forest;
         Console.WriteLine("Enter  : " + "森に到着、いい素材あるかな?");
     }
 }
Esempio n. 5
0
 public void HandleUnitAssignment(string unit)
 {
     //oh nee wat een vieze oplossing viez
     if (unit == "UpCollector")
     {
         Idle      idle          = IdleList[0];
         Transform spawnPosition = idle.transform;
         Instantiate(CollectorClass, spawnPosition.position, new Quaternion(0, 0, 0, 0));
         IdleList.Remove(idle);
         UnitList.Remove(idle);
         Destroy(idle.gameObject);
     }
     else if (unit == "DownCollector")
     {
         Collector collector     = CollectorsList[0];
         Transform spawnPosition = collector.transform;
         Instantiate(IdleClass, spawnPosition.position, new Quaternion(0, 0, 0, 0));
         CollectorsList.Remove(collector);
         UnitList.Remove(collector);
         Destroy(collector.gameObject);
     }
     else if (unit == "UpSoldier")
     {
         Idle      idle          = IdleList[0];
         Transform spawnPosition = idle.transform;
         Instantiate(SoldierClass, spawnPosition.position, new Quaternion(0, 0, 0, 0));
         IdleList.Remove(idle);
         UnitList.Remove(idle);
         Destroy(idle.gameObject);
     }
     else if (unit == "DownSoldier")
     {
         Soldier   soldier       = SoldierList[0];
         Transform spawnPosition = soldier.transform;
         Instantiate(IdleClass, spawnPosition.position, new Quaternion(0, 0, 0, 0));
         SoldierList.Remove(soldier);
         UnitList.Remove(soldier);
         Destroy(soldier.gameObject);
     }
     else if (unit == "UpAlchemist")
     {
         Idle      idle          = IdleList[0];
         Transform spawnPosition = idle.transform;
         Instantiate(AlchemistClass, spawnPosition.position, new Quaternion(0, 0, 0, 0));
         IdleList.Remove(idle);
         UnitList.Remove(idle);
         Destroy(idle.gameObject);
     }
     else if (unit == "DownAlchemist")
     {
         Alchemist alchemist     = AlchemistList[0];
         Transform spawnPosition = alchemist.transform;
         Instantiate(IdleClass, spawnPosition.position, new Quaternion(0, 0, 0, 0));
         AlchemistList.Remove(alchemist);
         UnitList.Remove(alchemist);
         Destroy(alchemist.gameObject);
     }
 }
 override public void Enter(Alchemist alchemist)
 {
     if (alchemist.m_location != Location.Atelier)
     {
         alchemist.m_location = Location.Forest;
         Console.Write("Enter: ");
         Console.WriteLine("アトリエに着いた、さあ調合しよう");
     }
 }
Esempio n. 7
0
        public void run()
        {
            //3 fabryki
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                FactoryWork(Resource.Lead);
            }).Start();
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                FactoryWork(Resource.Mercury);
            }).Start();
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                FactoryWork(Resource.Sulfur);
            }).Start();

            //czarodzieje
            for (int i = 0; i < this.wizardCount; i++)
            {
                new Thread(() =>
                {
                    Thread.CurrentThread.IsBackground = true;
                    WizardWork(i);
                }).Start();
            }

            //czarownicy
            for (int i = 0; i < this.warlockCount; i++)
            {
                new Thread(() =>
                {
                    Thread.CurrentThread.IsBackground = true;
                    WarlockWork(i);
                }).Start();
            }


            //alchemicy
            while (true)
            {
                printValues();
                Alchemist a = getRandomAlchemist();
                logEvent("Przychodzi alchemik " + (char)((int)a + 65));
                new Thread(() =>
                {
                    Thread.CurrentThread.IsBackground = true;
                    alchemists[(int)a].Invoke();
                }).Start();
                int sleepTime = getRandomMiliseconds(alchemistAppearRange[0], alchemistAppearRange[1]);
                logEvent("Sekund do przyjścia kolejnego alchemika: " + Math.Round(sleepTime / 1000f, 2));

                Thread.Sleep(sleepTime);
            }
        }
 override public void Enter(Alchemist alchemist)
 {
     if (alchemist.m_location != Location.Home)
     {
         alchemist.m_location = Location.Home;
         Console.Write("Enter  : ");
         Console.WriteLine("ただいまー");
     }
 }
Esempio n. 9
0
 private void CheckAvailabilityAndGiveResources(Alchemist alchemist, bool isSulfur, bool isLead, bool isMercury, Resource factoryType)
 {
     if (CheckAvailabilityForAlchemist(alchemist, isSulfur, isLead, isMercury))
     {
         int alchemistType = (int)alchemist;
         if (alchemistCount[alchemistType] > 0)
         {
             alchemistMutexes[alchemistType].Release();
             logEvent("Fabryka " + resolveResourceName(factoryType) + " wybiera zasoby dla alchemika" + alchemist.ToString());
             acquireResources(alchemist);
         }
     }
 }
Esempio n. 10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Alchemist maruru = new Alchemist(new GoAtelierAndSynthesis());

            maruru.m_location = Location.Atelier;
            for (int i = 0; i < 20; i++)
            {
                // System.Threading.Thread.Sleep(500);
                maruru.Update();
            }
            Console.WriteLine("調合できたアイテム数: " + maruru.m_itemCount);
        }
Esempio n. 11
0
        private static void AlchemistSpamer()
        {
            Random random = new Random(Guid.NewGuid().GetHashCode());
            var    delta  = LibSettings.Default.MaxAlchemistRespTime - LibSettings.Default.MinAlchemistRespTime;
            var    minVal = LibSettings.Default.MinAlchemistRespTime;

            System.Console.WriteLine("Spammer Begin");
            Alchemist alch = null;

            while (Working)
            {
                var Alchemist = random.Next() % 4;
                switch (Alchemist)
                {
                case 0:
                {
                    alch = new A_Alchemist();
                    StateLogger.SpawnedA++;
                    break;
                }

                case 1:
                {
                    alch = new B_Alchemist();
                    StateLogger.SpawnedB++;
                    break;
                }

                case 2:
                {
                    alch = new C_Alchemist();
                    StateLogger.SpawnedC++;
                    break;
                }

                case 3:
                {
                    alch = new D_Alchemist();
                    StateLogger.SpawnedD++;
                    break;
                }

                default:
                    break;
                }
                new Thread(alch.Run).Start();
                Thread.Sleep(minVal + random.Next() % delta);
            }
            System.Console.WriteLine("Spammer stop...");
        }
    override public void Execute(Alchemist alchemist)
    {
        alchemist.PickupIngredient();
        Console.Write("Execute: ");
        Console.Write("素材を見つけた! ingredients: " + alchemist.m_ingredientCount);
        alchemist.IncreaseFatigue();
        Console.WriteLine(" iFatigue: " + alchemist.m_iFatigue);

        if (alchemist.Fatigued())
        {
            Console.WriteLine("ふぅ、疲れたから家に帰ろう");
            alchemist.ChangeState(new ReturnToHomeAndRest());
            return;
        }
        else if (alchemist.PocketsFull())
        {
            Console.WriteLine("ポケットがいっぱいになっちゃったから帰ろう");
            alchemist.ChangeState(new GoAtelierAndSynthesis());
            return;
        }
    }
    override public void Execute(Alchemist alchemist)
    {
        Console.Write("Execute: ");
        if (alchemist.EnoughIngredient())
        {
            alchemist.Synthesis();
            alchemist.IncreaseFatigue();
            Console.WriteLine("良いものができた! item: " + alchemist.m_itemCount + " m_iFatigue: " + alchemist.m_iFatigue);

            if (alchemist.Fatigued())
            {
                Console.WriteLine("ふぅ、疲れたから家に帰ろう");
                alchemist.ChangeState(new ReturnToHomeAndRest());
            }
        }
        else
        {
            Console.WriteLine("素材が足りなくなっちゃった");
            alchemist.ChangeState(new EnterForestAndPickupGredient());
        }
    }
Esempio n. 14
0
        //rzeczywiste operacje pozyskania zasobów z magazynu - wymaga bycia w mutexie resourcesMutex!
        private void acquireResources(Alchemist alchemist)
        {
            int mercuryNumber = (int)Resource.Mercury;
            int leadNumber    = (int)Resource.Lead;
            int sulfurNumber  = (int)Resource.Sulfur;

            if (alchemist == Alchemist.AlchemistA)
            {
                resourceCount[mercuryNumber]--;
                resourceFull[mercuryNumber].Release();
                resourceCount[leadNumber]--;
                resourceFull[leadNumber].Release();
            }

            if (alchemist == Alchemist.AlchemistB)
            {
                resourceCount[sulfurNumber]--;
                resourceFull[sulfurNumber].Release();
                resourceCount[mercuryNumber]--;
                resourceFull[mercuryNumber].Release();
            }

            if (alchemist == Alchemist.AlchemistC)
            {
                resourceCount[leadNumber]--;
                resourceFull[leadNumber].Release();
                resourceCount[sulfurNumber]--;
                resourceFull[sulfurNumber].Release();
            }

            if (alchemist == Alchemist.AlchemistD)
            {
                resourceCount[leadNumber]--;
                resourceFull[leadNumber].Release();
                resourceCount[sulfurNumber]--;
                resourceFull[sulfurNumber].Release();
                resourceCount[mercuryNumber]--;
                resourceFull[mercuryNumber].Release();
            }
        }
Esempio n. 15
0
        private bool CheckAvailabilityForAlchemist(Alchemist alchemist, bool isSulfur, bool isLead, bool isMercury)
        {
            bool ret = true;

            foreach (var res in neededResourcesByAlchemist[(int)alchemist])
            {
                if (res == Resource.Sulfur)
                {
                    ret = ret && isSulfur;
                }
                if (res == Resource.Lead)
                {
                    ret = ret && isLead;
                }
                if (res == Resource.Mercury)
                {
                    ret = ret && isMercury;
                }
            }

            return(ret);
        }
Esempio n. 16
0
        public Archetype CreateClass(string type, SocketGuildUser guildUser)
        {
            switch (type)
            {
            case ("Acolyte"):
                Acolyte acolyte = new Acolyte(guildUser.Username, guildUser.Id);
                return(acolyte);

            case ("Komtur"):
                Honor komtur = new Honor(guildUser.Username, guildUser.Id);
                return(komtur);

            case ("Asigaru"):
                Asigaru asigaru = new Asigaru(guildUser.Username, guildUser.Id);
                return(asigaru);

            case ("Alchemist"):
                Alchemist alchemist = new Alchemist(guildUser.Username, guildUser.Id);
                return(alchemist);

            default:
                return(null);
            }
        }
    override public void Execute(Alchemist alchemist)
    {
        Console.Write("Execute: ");
        Console.WriteLine("休憩しよう m_iFatigue: " + alchemist.m_iFatigue);
        // alchemist.DecreaseFatigue();
        alchemist.Rest();

        if (alchemist.ImFine())
        {
            Console.WriteLine("気持ち良いお昼寝だったー");

            // 素材が足りていたら
            if (alchemist.EnoughIngredient() == true)
            {
                Console.WriteLine("先に調合しに行こうっと");
                alchemist.ChangeState(new GoAtelierAndSynthesis());
            }
            else // 素材が足りなかったら
            {
                Console.WriteLine("素材を取りに行こう");
                alchemist.ChangeState(new EnterForestAndPickupGredient());
            }
        }
    }
 override public void Exit(Alchemist alchemist)
 {
     Console.Write("Exit   : ");
     Console.WriteLine("いってきまーす");
 }
Esempio n. 19
0
 public virtual void Exit(Alchemist alchemist)
 {
 }
Esempio n. 20
0
 public virtual void Enter(Alchemist alchemist)
 {
 }
Esempio n. 21
0
 public AlchemistComboOrbwalker(Alchemist hero)
     : base(hero, 2000.0f)
 {
     this.hero = hero;
 }
 override public void Exit(Alchemist alchemist)
 {
     Console.WriteLine("Exit   : ");
     // Console.WriteLine("素材探しに行こうっと");
 }
 override public void Exit(Alchemist alchemist)
 {
     Console.WriteLine("Exit   : ");
     // Console.WriteLine("森から出よう");
 }
Esempio n. 24
0
 public virtual void Execute(Alchemist alchemist)
 {
 }
        // Token: 0x060003A4 RID: 932 RVA: 0x0001C404 File Offset: 0x0001A604
        public UnitMonitor()
        {
            Dictionary <string, Action <Unit9, bool> > dictionary = new Dictionary <string, Action <Unit9, bool> >();

            dictionary.Add("modifier_teleporting", delegate(Unit9 x, bool value)
            {
                x.IsTeleporting = value;
            });
            dictionary.Add("modifier_treant_natures_guise_invis", delegate(Unit9 x, bool value)
            {
                x.CanUseAbilitiesInInvisibility = value;
            });
            dictionary.Add("modifier_riki_permanent_invisibility", delegate(Unit9 x, bool value)
            {
                x.CanUseAbilitiesInInvisibility = value;
            });
            dictionary.Add("modifier_ice_blast", delegate(Unit9 x, bool value)
            {
                x.CanBeHealed = !value;
            });
            dictionary.Add("modifier_item_aegis", delegate(Unit9 x, bool value)
            {
                x.HasAegis = value;
            });
            dictionary.Add("modifier_necrolyte_sadist_active", delegate(Unit9 x, bool value)
            {
                x.IsEthereal = value;
            });
            dictionary.Add("modifier_pugna_decrepify", delegate(Unit9 x, bool value)
            {
                x.IsEthereal = value;
            });
            dictionary.Add("modifier_item_ethereal_blade_ethereal", delegate(Unit9 x, bool value)
            {
                x.IsEthereal = value;
            });
            dictionary.Add("modifier_ghost_state", delegate(Unit9 x, bool value)
            {
                x.IsEthereal = value;
            });
            dictionary.Add("modifier_item_lotus_orb_active", delegate(Unit9 x, bool value)
            {
                x.IsLotusProtected = value;
            });
            dictionary.Add("modifier_antimage_counterspell", delegate(Unit9 x, bool value)
            {
                x.IsSpellShieldProtected = value;
            });
            dictionary.Add("modifier_item_sphere_target", delegate(Unit9 x, bool value)
            {
                x.IsLinkensTargetProtected = value;
            });
            dictionary.Add("modifier_item_blade_mail_reflect", delegate(Unit9 x, bool value)
            {
                x.IsReflectingDamage = value;
            });
            dictionary.Add("modifier_item_ultimate_scepter", delegate(Unit9 x, bool value)
            {
                x.HasAghanimsScepter = value;
            });
            dictionary.Add("modifier_item_ultimate_scepter_consumed", delegate(Unit9 x, bool value)
            {
                x.HasAghanimsScepter = value;
            });
            dictionary.Add("modifier_wisp_tether_scepter", delegate(Unit9 x, bool value)
            {
                x.HasAghanimsScepter = value;
            });
            dictionary.Add("modifier_slark_dark_pact", delegate(Unit9 x, bool value)
            {
                x.IsDarkPactProtected = value;
            });
            dictionary.Add("modifier_bloodseeker_rupture", delegate(Unit9 x, bool value)
            {
                x.IsRuptured = value;
            });
            dictionary.Add("modifier_spirit_breaker_charge_of_darkness", delegate(Unit9 x, bool value)
            {
                x.IsCharging = value;
            });
            dictionary.Add("modifier_dragon_knight_dragon_form", delegate(Unit9 x, bool value)
            {
                x.IsRanged = (value || x.BaseUnit.IsRanged);
            });
            dictionary.Add("modifier_terrorblade_metamorphosis", delegate(Unit9 x, bool value)
            {
                x.IsRanged = (value || x.BaseUnit.IsRanged);
            });
            dictionary.Add("modifier_troll_warlord_berserkers_rage", delegate(Unit9 x, bool value)
            {
                x.IsRanged = (!value || x.BaseUnit.IsRanged);
            });
            dictionary.Add("modifier_lone_druid_true_form", delegate(Unit9 x, bool value)
            {
                x.IsRanged = (!value || x.BaseUnit.IsRanged);
            });
            dictionary.Add("modifier_slark_shadow_dance_visual", delegate(Unit9 x, bool value)
            {
                Slark slark = x.Owner as Slark;
                if (slark == null)
                {
                    return;
                }
                slark.ShadowDanced(value);
            });
            dictionary.Add("modifier_morphling_replicate", delegate(Unit9 x, bool value)
            {
                Morphling morphling = x as Morphling;
                if (morphling == null)
                {
                    return;
                }
                morphling.Morphed(value);
            });
            dictionary.Add("modifier_morphling_replicate_manager", delegate(Unit9 x, bool value)
            {
                Morphling morphling = x as Morphling;
                if (morphling == null)
                {
                    return;
                }
                morphling.Replicated(value);
            });
            dictionary.Add("modifier_alchemist_chemical_rage", delegate(Unit9 x, bool value)
            {
                Alchemist alchemist = x as Alchemist;
                if (alchemist == null)
                {
                    return;
                }
                alchemist.Raged(value);
            });
            this.specialModifiers = dictionary;
            base..ctor();
            this.damageFactory            = new DamageFactory();
            this.rangeFactory             = new RangeFactory();
            Entity.OnInt64PropertyChange += this.OnInt64PropertyChange;
            Entity.OnInt32PropertyChange += this.OnInt32PropertyChange;
            Entity.OnAnimationChanged    += this.OnAnimationChanged;
            Unit.OnModifierAdded         += this.OnModifierAdded;
            Unit.OnModifierRemoved       += this.OnModifierRemoved;
            Player.OnExecuteOrder        += this.OnExecuteOrder;
            Drawing.OnDraw += UnitMonitor.OnUpdate;
        }
Esempio n. 26
0
        void Handle4XButton(Button button)
        {
            switch (button.Action)
            {
            case "enchanter":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Enchanter.Copy(HashID++));
                    EnchanterButtons = GenerateEnchantments();
                    UpdateOptions    = true;
                    GoldRoomChosen   = true;
                }
                break;

            case "merchant":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    ShopInventory = GenerateShopInventory();
                    Save.GetGoldRoom().AddToRoom(Merchant.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "alchemist":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Alchemist.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "medic":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Medic.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "gambler":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Gambler.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "pharmacist":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Pharmacist.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "room":
                if (!((RoomButton)button).Room.Worked && Save.Kevin.Power >= ((RoomButton)button).Room.Cost)
                {
                    ((RoomButton)button).Room.Worked  = true;
                    ((RoomButton)button).Room.Visited = true;
                    Save.Kevin.Power         -= ((RoomButton)button).Room.Cost;
                    Save.Kevin.PowerPerTurn  += ((RoomButton)button).Room.Power;
                    Save.Kevin.WealthPerTurn += ((RoomButton)button).Room.Wealth;
                    Save.Kevin.ExperiencePerTurn++;
                    button.Sprite = PoweredRoom;
                }
                break;

            case "door":
                // Congrats
                break;
            }
        }