Exemplo n.º 1
0
Arquivo: Load.cs Projeto: pl0xie/AIM
        public static void OnGameUpdate(EventArgs args)
        {
            if (Utility.Map.GetMap().Type == Utility.Map.MapType.HowlingAbyss)
            {
                UsePorosnax();

                try
                {
                    if (!ModeLoaded &&
                        (Environment.TickCount - _loadTickCount > 60000 || ObjectManager.Player.Level > 3))
                    {
                        var carryMode = new Carry();
                    }
                }

                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            else
            {
                //Console.WriteLine("Map not yet supported, use AutoSharpporting ;)");
                new Carry();
            }
        }
Exemplo n.º 2
0
        public static List <int> PlusOne(List <int> A)
        {
            if (A == null)
            {
                return(null);
            }

            Carry carry = new Carry();

            PlusOneHelper(A, A.Count - 1, carry);

            List <int> lstResult = new List <int>();

            if (carry.val > 0)
            {
                List <int> withCarry = new List <int>();
                withCarry.Add(carry.val);
                withCarry.AddRange(A);
                lstResult = RemoveZeros(withCarry);
            }
            else
            {
                lstResult = RemoveZeros(A);
            }

            return(lstResult);
        }
Exemplo n.º 3
0
 public static void CPY(IOperand o)                                              //N Z C
 {
     GenericAssembler(Asm.OC["CPY"], o);
     Carry.Reset();
     Flags.Negative.Alter();
     Flags.Zero.Alter(Y);
     Flags.Carry.Alter(Y);
 }
Exemplo n.º 4
0
 public static void SwitchChrTo(RegisterA a)
 {
     Carry.Clear();
     A.ROL().ROL().ROL().ROL().ROL();
     Temp[0].Set(A);
     Bank.And(0b00011111).ADC(Temp[0]);
     GoSub(_SwitchBanks);
 }
Exemplo n.º 5
0
 public static void ADC(IOperand o)                                              //N V Z C
 {
     GenericAssembler(Asm.OC["ADC"], o);
     Carry.Reset();
     A.State.Alter();
     Flags.Negative.Alter(A);
     Flags.Overflow.Alter(A);
     Flags.Zero.Alter(A);
     Flags.Carry.Alter(A);
 }
Exemplo n.º 6
0
 public static void SwitchChrTo(U8 bankNum)
 {
     if (bankNum > 31)
     {
         throw new Exception("PRG bank range is 0-31");
     }
     Carry.Clear();
     A.Set(bankNum).ROL().ROL().ROL().ROL().ROL();
     Temp[0].Set(A);
     Bank.And(0b00011111).ADC(Temp[0]);
     GoSub(_SwitchBanks);
 }
Exemplo n.º 7
0
        public void Update(Vector2 mousePos)
        {
            if (ControlsActive == true)
            {
                Controling();
            }

            CurretnObjectControl.PhysicsMove(this);

            if (MouseInput.MouseStateNew.LeftButton == ButtonState.Released)
            {
                (Weapons[2] as LaserGun).SetOff();
            }

            if (KeyboardInput.KeyboardStateOld.IsKeyUp(Keys.E) && KeyboardInput.KeyboardStateNew.IsKeyDown(Keys.E))
            {
                if (CurretnObjectControl is BuddyModule)
                {
                    foreach (ITriggers trgr in Game1.mapLive.mapTriggers)
                    {
                        if (CompareF.RectangleFVsRectangleF(Boundary, trgr.Boundary))
                        {
                            trgr.TriggerSwitch();
                        }
                    }

                    foreach (ICrate crt in Game1.mapLive.mapCrates.Reverse <ICrate>())
                    {
                        if (CompareF.RectangleFVsRectangleF(Boundary, crt.Boundary))
                        {
                            crt.Open();
                        }
                    }
                }
            }

            UpdateHealth();
            UpdateShield();

            CurretnObjectControl.HowILookCalc(this);

            if (Carry != null)
            {
                Carry.Carry(Boundary.Origin);
            }

            if ((CurretnObjectControl is BuddyModule) && (Resolver.VerticalPressure == true || Resolver.HorizontalPressure == true))
            {
                Kill();
            }
        }
Exemplo n.º 8
0
 void Update()
 {
     if (pm.alive == true)
     {
         distance = Vector3.Distance(player.position, transform.position);
         string distanceScore = distance.ToString("f0");
         tScore.text = distanceScore;
         cScore      = distance;
         flakeScore  = sfScore;
         Carry.Score(cScore, flakeScore);
         string snowflakeScore = sfScore.ToString("f0");
         snowflakes.text = snowflakeScore;
     }
 }
Exemplo n.º 9
0
        public static void ROR(IOperand o)                                              //N Z C
        {
            GenericAssembler(Asm.OC["ROR"], o);
            Carry.Reset();
            if (o is RegisterA)
            {
                A.State.Alter();
            }
            var reg = o is RegisterA ? A : null;

            Flags.Negative.Alter(reg);
            Flags.Zero.Alter(reg);
            Flags.Carry.Alter(reg);
        }
Exemplo n.º 10
0
        public static IGameDescriptor GenerateDefaultMap()
        {
            TownHall townHall = new TownHall("TownHall", 100, 100, false, null, new Coordinates {
                x = 13, y = 34
            });
            Carry carry = new Carry(0, "Carry1", new Coordinates {
                x = 1220, y = 620
            });
            //Tree tree = new Tree("Tree1", new Coordinates { x = 30, y = 30 });
            GoldMine mine = new GoldMine(0, "Gold mine1", new Coordinates {
                x = 1301, y = 82
            });
            Farm farm1 = new Farm(0, "Farm1", new Coordinates {
                x = 23, y = 557
            });
            Farm farm2 = new Farm(1, "Farm2", new Coordinates {
                x = 178, y = 557
            });
            Worker worker1 = new Worker(100, false, null, new Coordinates {
                x = 400, y = 400
            });
            Worker worker2 = new Worker(100, false, null, new Coordinates {
                x = 450, y = 450
            });

            var Resources = new SerializableDictionary <ResourcesType, int> {
                { ResourcesType.Gold, 1000 }, { ResourcesType.Stone, 1000 }, { ResourcesType.Wood, 1000 }
            };

            var game = new GameDescriptor();

            game.TownHalls.Add(townHall.ToTownHallDescriptor());
            game.Carries.Add(carry.ToCarryDescriptor());
            //game.Trees.Add(tree);
            game.GoldMines.Add(mine.ToGoldMineDescriptor());
            game.Farms.Add(farm1.ToFarmDescriptor());
            game.Farms.Add(farm2.ToFarmDescriptor());
            game.Workers.Add(worker1.ToWorkerDescriptor());
            game.Workers.Add(worker2.ToWorkerDescriptor());
            game.Resources        = Resources;
            game.MaxPopulation    = game.Farms.Count * game.Farms[0].PopulationIncrement;
            game.ActualPopulation = game.Workers.Count * game.Workers[0].PopulationSlots;

            return((IGameDescriptor)game);
        }
Exemplo n.º 11
0
 public RegisterA Subtract(IOperand o)
 {
     Carry.Set();
     if (o is RegisterX)
     {
         Temp[0].Set(X);
         SBC(Temp[0]);
     }
     else if (o is RegisterY)
     {
         Temp[0].Set(Y);
         SBC(Temp[0]);
     }
     else
     {
         SBC(o);
     }
     return(this);
 }
Exemplo n.º 12
0
        public void FetchResource_TriggersEventOnResourceFetched_Ok()
        {
            //
            var worker = new Worker();
            var carry  = new Carry(0, "tree", new Coordinates {
                x = 10, y = 10
            }, 2000);
            bool isTriggered = false;

            //
            Assert.AreEqual(0, worker.HoldedResources[ResourcesType.Stone]);
            // Trigger déclenché
            worker.ResourceCollected += (obj, args) => isTriggered = true;
            worker.FetchResource(carry);

            //
            Thread.Sleep(carry.FetchTimeEllapse + 500);
            Assert.IsTrue(worker.HoldedResources[ResourcesType.Stone] > 0);
            Assert.IsTrue(isTriggered);
        }
Exemplo n.º 13
0
        public static RegisterA Multiply(this RegisterA a, U8 n)
        {
            switch ((int)n)
            {
            case 2:
                Carry.Clear();
                //return A.RotateLeft();
                return(A.ASL());                        //no need to CLC

            case 4:
                return(A.Multiply(2).Multiply(2));

            case 8:
                return(A.Multiply(4).Multiply(2));

            case 16:
                return(A.Multiply(8).Multiply(2));

            default: throw new NotImplementedException();
            }
        }
Exemplo n.º 14
0
    public object Create(object Enum)
    {
        EnumHeroes code = (EnumHeroes)Enum;
        IHero      hero = null;

        switch (code)
        {
        case EnumHeroes.Carry:
            hero = new Carry();
            break;

        case EnumHeroes.Disabler:
            hero = new Disabler();
            break;

        case EnumHeroes.Jungler:
            hero = new Jungler();
            break;

        case EnumHeroes.Nucker:
            hero = new Nucker();
            break;

        case EnumHeroes.Roamer:
            hero = new Roamer();
            break;

        case EnumHeroes.Support:
            hero = new Support();
            break;

        case EnumHeroes.Tank:
            hero = new Tank();
            break;
        }
        SetHeroStats(ref hero, GetJsonParams(code));
        return(hero);
    }
Exemplo n.º 15
0
    void pickup()
    {
        if (Input.GetMouseButton(0))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;

            Ray        ray = mainCamera.GetComponent <Camera>().ScreenPointToRay(new Vector3(x, y));
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                Carry p = hit.collider.GetComponent <Carry>();
                if (p != null)
                {
                    carrying      = true;
                    carriedObject = p.gameObject;
                    p.gameObject.GetComponent <Rigidbody>().useGravity = false;
                    //p.gameObject.GetComponent<Light> ().enabled = true;
                    p.gameObject.GetComponent <Carry> ().isCarried = true;
                }
            }
        }
    }
Exemplo n.º 16
0
        public static void PlusOneHelper(List <int> A, int curIndex, Carry carry)
        {
            if (curIndex < 0)
            {
                return;
            }

            int addedValue;

            if (curIndex == A.Count - 1)
            {
                addedValue = A[curIndex] + carry.val + 1;
            }
            else
            {
                addedValue = A[curIndex] + carry.val;
            }

            carry.val   = (addedValue > 9) ? 1 : 0;
            A[curIndex] = addedValue % 10;

            PlusOneHelper(A, curIndex - 1, carry);
        }
Exemplo n.º 17
0
 public RegisterA Add(IOperand o)
 {
     Carry.Clear();
     if (o is RegisterA)
     {
         throw new Exception("Attempting to add A to A");
     }
     else if (o is RegisterX)
     {
         Temp[0].Set(X);
         ADC(Temp[0]);
     }
     else if (o is RegisterY)
     {
         Temp[0].Set(Y);
         ADC(Temp[0]);
     }
     else
     {
         ADC(o);
     }
     return(this);
 }
Exemplo n.º 18
0
    void Start()
    {
        animator       = GetComponentInChildren <Animator>();
        playerMovement = GetComponent <PlayerMovement>();
        carry          = GetComponent <Carry>();
        var controller = animator.runtimeAnimatorController;

        // Add events onto the throw animation
        foreach (var clip in controller.animationClips)
        {
            if (clip.name == "goalie_throw")
            {
                AnimationEvent throwEvent = new AnimationEvent();
                throwEvent.functionName = "ThrowObject";
                throwEvent.time         = 0.28f;
                clip.AddEvent(throwEvent);

                AnimationEvent finishedEvent = new AnimationEvent();
                finishedEvent.functionName = "ThrowFinished";
                finishedEvent.time         = 1.0f;
                clip.AddEvent(finishedEvent);
            }
        }
    }
Exemplo n.º 19
0
        /// <summary>
        /// Kauft einen Carry.
        /// Zur Berechnung der Bewegungsreichweite einer Ameise wird die Diagonale des Spielfeldes mit dem gewählten moveRangeFactor multipliziert.
        /// (Eine Umrundung des Spielfeldes benötigt mindestens einen moveRangeFactor von Drei.)
        /// </summary>
        /// <param name="viewRange">Die Sichtweite der Ameise.</param>
        /// <param name="inventory">Die Maximale Anzahl an Zucker, die die Ameise tragen kann.</param>
        /// <param name="moveRangeFactor">Wie weit die Ameise gehen kann.</param>
        /// <param name="hp">Lebenspunkte der Ameise.</param>
        /// <returns>true wenn der Carry erfolgreich gekauft wird andernfalls wenn man nicht genug Geld hat false.</returns>
        protected bool buyCarrier(int viewRange, int inventory, int moveRangeFactor, int hp)
        {
            Carry c = new Carry(Game.Board, Player, viewRange, inventory, moveRangeFactor, hp);

            return(buyAnt(c));
        }
Exemplo n.º 20
0
 public void putDown()
 {
     StartCoroutine(_LockMovementAndAttack(0, 1.16f));
     carry = global::Carry.NOTCARRY;
     animator.SetInteger("Weapon", 0);
 }
Exemplo n.º 21
0
 public static RegisterA Negate(RegisterA _)
 {
     A.Xor(0xFF);
     Carry.Set();
     return(A.ADC(0));
 }
Exemplo n.º 22
0
        public void Controling()
        {
            CurretnObjectControl.ControlPlayer(this);

            if (KeyboardInput.KeyboardStateNew.IsKeyDown(Game1.STP.ControlKeys["Grab"]) &&
                KeyboardInput.KeyboardStateOld.IsKeyUp(Game1.STP.ControlKeys["Grab"]))
            {
                bool justLeft = false;

                if (Carry != null)
                {
                    Carry.LetGo(Velocity);
                    Carry = null;
                }
                else
                {
                    if (Game1.PlayerInstance.InVehicle == true)
                    {
                        LeftVehicle();
                        justLeft = true;
                    }

                    foreach (Inpc npc in Game1.mapLive.MapNpcs.Reverse <Inpc>())
                    {
                        if (justLeft == false)
                        {
                            if (npc is Icarry && Game1.PlayerInstance.InVehicle == false)
                            {
                                if (CompareF.RectangleFVsRectangleF
                                        (Game1.PlayerInstance.Boundary, npc.Boundary) == true)
                                {
                                    Carry = (npc as Icarry);
                                    break;
                                }
                            }
                        }

                        if (InVehicle == false && justLeft == false)
                        {
                            if (npc is Ivehicle)
                            {
                                if (Carry == null)
                                {
                                    if (CompareF.RectangleFVsRectangleF
                                            (Game1.PlayerInstance.Boundary, npc.Boundary) == true)
                                    {
                                        curretnBoundary = Boundary;

                                        Game1.mapLive.MapNpcs.Remove(npc);
                                        if (npc is PlayerMech)
                                        {
                                            CurretnObjectControl =
                                                new MechModule(this, npc.Boundary.Origin, (npc as Ivehicle).Health);
                                        }
                                        else if (npc is PlayerAircraft)
                                        {
                                            CurretnObjectControl =
                                                new AircraftModule(this, npc.Boundary.Origin, (npc as Ivehicle).Health);
                                        }
                                        InVehicle = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 23
0
 public static RegisterA Negate(VByte v)
 {
     A.Set(v).Xor(0xFF);
     Carry.Set();
     return(A.ADC(0));
 }
Exemplo n.º 24
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo goo   = null;
            Image   image = new Image();

            if (!DA.GetData(0, ref goo))
            {
                return;
            }
            if (!goo.TryGetImage(ref image))
            {
                return;
            }

            int mode = 0;

            DA.GetData(1, ref mode);

            int numVal = 0;

            DA.GetData(2, ref numVal);

            Filter filter = new Filter();

            switch ((FilterModes)mode)
            {
            case FilterModes.Bayer:
                filter = new Bayer();
                image.Filters.Add(new Bayer());
                break;

            case FilterModes.Ordered:
                filter = new Ordered();
                image.Filters.Add(new Ordered());
                break;

            case FilterModes.Burkes:
                filter = new Burkes(numVal);
                image.Filters.Add(new Burkes(numVal));
                break;

            case FilterModes.Carry:
                filter = new Carry(numVal);
                image.Filters.Add(new Carry(numVal));
                break;

            case FilterModes.FloydSteinberg:
                filter = new FloydSteinberg(numVal);
                image.Filters.Add(new FloydSteinberg(numVal));
                break;

            case FilterModes.JarvisJudiceNinke:
                filter = new JarvisJudiceNinke(numVal);
                image.Filters.Add(new JarvisJudiceNinke(numVal));
                break;

            case FilterModes.Sierra:
                filter = new Sierra(numVal);
                image.Filters.Add(new Sierra(numVal));
                break;

            case FilterModes.Stucki:
                filter = new Stucki(numVal);
                image.Filters.Add(new Stucki(numVal));
                break;
            }

            message = ((FilterModes)mode).ToString();
            UpdateMessage();

            DA.SetData(0, image);
            DA.SetData(1, filter);
        }
Exemplo n.º 25
0
 void Start()
 {
     state = new WalkingState(this);
     carry = GetComponent <Carry>();
 }
Exemplo n.º 26
0
 public static CarryDescriptor ToCarryDescriptor(this Carry carry)
 {
     return(Mapper.Map <CarryDescriptor>(carry));
 }