use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.
the class PointCaptureFireworks method onPointCaptured.
@Handler(priority = Priority.LAST)
public void onPointCaptured(PointCapturedEvent event) {
if (this.isEnabled() && !event.isCanceled()) {
Point point = event.getPoint();
Region region = point.getCapture().getRegion();
Color color = event.getNewOwner().getColor();
for (Location at : this.getRegionCorners(region.getBounds())) {
this.fireComplete(at, color);
}
}
}
use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.
the class FlagFactory method parseFlagCapture.
public FlagCapture parseFlagCapture(CaptureGame game, Element xml, FlagCapture capture) {
Region region = XMLRegion.parseUnion(game.getGame(), xml);
if (region == null) {
return null;
}
capture.setFieldStrategy(this.findRegionFieldStrategy(xml, FlagCapture.DEFAULT_FIELD_STRATEGY));
capture.setFilter(this.findFilter(game.getGame(), xml.getAttributeValue("filter"), FlagCapture.DEFAULT_FILTER));
capture.setRegion(region);
return capture;
}
use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.
the class FlagFactory method parseFlagSpawn.
public FlagSpawn parseFlagSpawn(CaptureGame game, Element xml, FlagSpawn spawn) {
Region region = XMLRegion.parseUnion(game.getGame(), xml);
if (region == null) {
return null;
}
spawn.setFieldStrategy(this.findRegionFieldStrategy(xml, FlagSpawn.DEFAULT_FIELD_STRATEGY));
spawn.setFilter(this.findFilter(game.getGame(), xml.getAttributeValue("filter"), FlagSpawn.DEFAULT_FILTER));
spawn.setRegion(region);
return spawn;
}
use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.
the class PointFactory method parsePointCapture.
public PointCapture parsePointCapture(CaptureGame game, Element xml, PointCapture capture) {
Region region = XMLRegion.parseUnion(game.getGame(), xml);
if (region == null) {
return null;
}
capture.setFieldStrategy(this.findRegionFieldStrategy(xml, PointCapture.DEFAULT_FIELD_STRATEGY));
capture.setFilter(this.findFilter(game.getGame(), xml.getAttributeValue("filter"), PointCapture.DEFAULT_FILTER));
capture.setRegion(region);
return capture;
}
use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.
the class PointFactory method parsePointXml.
public Point parsePointXml(CaptureGame game, Element xml, Point point) {
// capture region
Element captureElement = xml.getChild("capture");
if (captureElement == null) {
return null;
}
PointCapture capture = this.parsePointCapture(game, captureElement, new PointCapture(game, point));
if (capture == null) {
return null;
}
// state region
Element stateElement = xml.getChild("state");
Region stateRegion = stateElement != null ? XMLRegion.parseUnion(game.getGame(), stateElement) : null;
if (stateRegion == null) {
// Set state region to the capture region (if it is not set).
stateRegion = capture.getRegion();
}
// setup
point.setCapture(capture);
point.setCaptureTime(Time.parseTime(xml.getAttributeValue("capture-time"), Point.DEFAULT_CAPTURE_TIME));
point.setCapturingCapturedEnabled(XMLParser.parseBoolean(xml.getAttributeValue("capturing-captured"), false));
point.setDominatorStrategy(this.findDominatorStrategy(xml, Point.DEFAULT_DOMINATOR_STRATEGY));
point.setDominateFilter(this.findFilter(game.getGame(), xml.getAttributeValue("dominate-filter"), Point.DEFAULT_DOMINATE_FILTER));
point.setLoseTime(Time.parseTime(xml.getAttributeValue("lose-time"), Point.DEFAULT_LOSE_TIME));
point.setNeutralColor(Color.parse(xml.getAttributeValue("color"), Point.DEFAULT_NEUTRAL_COLOR));
point.setObjective(XMLParser.parseBoolean(xml.getAttributeValue("objective"), false));
point.setPermanent(XMLParser.parseBoolean(xml.getAttributeValue("permanent"), false));
point.setPointReward(XMLParser.parseDouble(xml.getAttributeValue("point-reward"), Score.ZERO));
point.setStateRegion(stateRegion);
return point;
}
Aggregations