Britbot
override bool Britbot.Simulator.GroupArrivalEvent.Activate ( SimulatedGame  sg) [inline, virtual]

this updates the game as if ArrivingGroup arrived (considering forces and stuff)

Parameters:
sg

Implements Britbot.Simulator.SimulatedEvent.

Definition at line 43 of file GroupArrivalEvent.cs.

        {
            if (this.ArrivingGroup.IsBusy)
                return false;

            this.ArrivingGroup.IsBusy = true;

            if (this.ArrivingGroup == null)
                return false;

            if (!this.ArrivingGroup.IsAlive)
                return false;

            if (this.Island.CapturingGroup != null)
            {
                if (this.Island.CapturingGroup.Owner == this.ArrivingGroup.Owner)
                    return false;

                //opponenets
                if (this.Island.CapturingGroup.IsAlive)
                {
                    if (this.Island.CapturingGroup.ActualFirePower() > this.ArrivingGroup.FirePower)
                    {
                        this.ArrivingGroup.Kill(sg);
                        return false;
                    }
                    if (this.Island.CapturingGroup.ActualFirePower() == this.ArrivingGroup.FirePower)
                    {
                        this.ArrivingGroup.Kill(sg);
                        this.Island.CapturingGroup.Kill(sg);
                        return false;
                    }
                    this.Island.CapturingGroup.Kill(sg);
                    this.Island.TurnsBeingCaptured = 0;
                }
            }

            this.Island.CapturingGroup = this.ArrivingGroup;

            if (this.Island.Owner == this.ArrivingGroup.Owner)
                return false;
            if (this.Island.Owner == Consts.NO_OWNER)
                sg.AddEvent(new CaptureEvent(sg.CurrentTurn + 20 - this.Island.TurnsBeingCaptured, this.Island,
                    this.ArrivingGroup));
            else
                sg.AddEvent(new DeCaptureEvent(sg.CurrentTurn + 20 - this.Island.TurnsBeingCaptured, this.Island,
                    this.ArrivingGroup));

            return false;
        }