Exemplo n.º 1
0
        override public bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            SkillEffect other = (SkillEffect)obj;

            if (id != other.id)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
 void addDeadToFrame(SkillEffect s)
 {
     frameData.Add(String.Join(" ", s.ToFrameData(), "d"));
 }
Exemplo n.º 3
0
        public void handlePlayerOutput(int frame, int round, int playerIdx, String[] outputs)
        {
            Player player   = players[playerIdx];
            String expected = EXPECTED;

            for (int i = 0; i < LOOTER_COUNT; ++i)
            {
                String line = outputs[i];
                Match  match;
                try {
                    Looter looter = players[playerIdx].looters[i];

                    match = PLAYER_WAIT_PATTERN.Match(line);
                    if (match.Success)
                    {
                        looter.attempt = Action.WAIT;
                        matchMessage(looter, match);
                        continue;
                    }

                    match = PLAYER_MOVE_PATTERN.Match(line);
                    if (match.Success)
                    {
                        looter.attempt = Action.MOVE;
                        int x     = Int32.Parse(match.Groups["x"].Value);
                        int y     = Int32.Parse(match.Groups["y"].Value);
                        int power = Int32.Parse(match.Groups["power"].Value);

                        looter.setWantedThrust(new Point(x, y), power);
                        matchMessage(looter, match);
                        continue;
                    }

                    match = PLAYER_SKILL_PATTERN.Match(line);
                    if (match.Success)
                    {
                        if (!looter.skillActive)
                        {
                            // Don't kill the player for that. Just do a WAIT instead
                            looter.attempt = Action.WAIT;
                            matchMessage(looter, match);
                            continue;
                        }

                        looter.attempt = Action.SKILL;
                        int x = Int32.Parse(match.Groups["x"].Value);
                        int y = Int32.Parse(match.Groups["y"].Value);

                        SkillResult result = new SkillResult(x, y);
                        looter.skillResult = result;

                        try {
                            SkillEffect effect = looter.skill(new Point(x, y));
                            skillEffects.Add(effect);
                        } catch (NoRageException /*e*/) {
                            result.code = SkillResult.NO_RAGE;
                        } catch (TooFarException /*e*/) {
                            result.code = SkillResult.TOO_FAR;
                        }
                        matchMessage(looter, match);
                        continue;
                    }

                    throw new InvalidInputException(expected, line);
                } catch (InvalidInputException e) {
                    player.Kill();
                    throw e;
                } catch (Exception e) {
                    //StringWriter errors = new StringWriter();
                    //e.printStackTrace(new PrintWriter(errors));
                    //printError(e.getMessage() + "\n" + errors.toString());
                    System.Diagnostics.Debug.WriteLine(e);
                    player.Kill();
                    throw new InvalidInputException(expected, line);
                }
            }
        }
Exemplo n.º 4
0
 void addToFrame(SkillEffect s)
 {
     frameData.Add(s.ToFrameData());
 }