func (self *move) adjudicateMovementPhase(r dip.Resolver) error { unit, _, _ := r.Unit(self.targets[0]) convoyed := cla.MustConvoy(r, self.targets[0]) if convoyed { if cla.AnyConvoyPath(r, self.targets[0], self.targets[1], true, nil) == nil { return cla.ErrMissingConvoyPath } } if err := self.adjudicateAgainstCompetition(r, nil); err != nil { return err } var forbiddenSupporter *dip.Nation // at destination if victim, _, hasVictim := r.Unit(self.targets[1]); hasVictim { forbiddenSupporter = &victim.Nation attackStrength := cla.MoveSupport(r, self.targets[0], self.targets[1], []dip.Nation{victim.Nation}) + 1 order, prov, _ := r.Order(self.targets[1]) dip.Logf("'%v' vs '%v': %v", self, order, attackStrength) if order.Type() == cla.Move { victimConvoyed := cla.MustConvoy(r, order.Targets()[0]) if !convoyed && !victimConvoyed && order.Targets()[1].Super() == self.targets[0].Super() { as := cla.MoveSupport(r, order.Targets()[0], order.Targets()[1], []dip.Nation{unit.Nation}) + 1 dip.Logf("'%v' vs '%v': %v", order, self, as) if victim.Nation == unit.Nation || as >= attackStrength { return cla.ErrBounce{self.targets[1]} } } else { dip.Logf("Esc(%v)", order.Targets()[0]) dip.Indent(" ") if err := r.Resolve(prov); err == nil { dip.DeIndent() dip.Logf("Success") forbiddenSupporter = nil } else { dip.DeIndent() dip.Logf("Failure: %v", err) if victim.Nation == unit.Nation || 1 >= attackStrength { return cla.ErrBounce{self.targets[1]} } } } } else { hs := cla.HoldSupport(r, self.targets[1]) + 1 dip.Logf("'%v': %v", order, hs) if victim.Nation == unit.Nation || hs >= attackStrength { return cla.ErrBounce{self.targets[1]} } } } if err := self.adjudicateAgainstCompetition(r, forbiddenSupporter); err != nil { return err } return nil }