-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zerg ResourceDepots refactor/training functionality, MobileUnit build time, BWEM initalization #63
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -706,9 +706,14 @@ && hasResearched(type.requiredTech()) | |
} | ||
|
||
public boolean canMake(Unit builder, UnitType type) { | ||
if (!canMake(type) || !builder.isA(type.whatBuilds().getFirst())) { | ||
return false; | ||
} | ||
if (!canMake(type) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check is intended to allow the case where Thought I'd keep the checks against There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Edit: Nevermind that. It probably already returns true. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - the conditional is intended to filter out any invalid |
||
|| !(builder.isA(type.whatBuilds().getFirst()) | ||
|| (type.whatBuilds().getFirst().equals(UnitType.Zerg_Larva) | ||
&& (builder.isA(UnitType.Zerg_Hatchery) | ||
|| builder.isA(UnitType.Zerg_Lair) | ||
|| builder.isA(UnitType.Zerg_Hive))))) { | ||
return false; | ||
} | ||
return type.requiredUnits() | ||
.stream() | ||
.filter(UnitType::isAddon) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
// This file is part of BWAPI4J. | ||
// | ||
// BWAPI4J is free software: you can redistribute it and/or modify | ||
// it under the terms of the Lesser GNU General Public License as published | ||
// it under the terms of the Lesser GNU General Public License as published | ||
// by the Free Software Foundation, version 3 only. | ||
// | ||
// BWAPI4J is distributed in the hope that it will be useful, | ||
|
@@ -20,48 +20,51 @@ | |
|
||
package org.openbw.bwapi4j.unit; | ||
|
||
import org.openbw.bwapi4j.type.UnitCommandType; | ||
import org.openbw.bwapi4j.type.UnitType; | ||
import org.openbw.bwapi4j.type.UpgradeType; | ||
|
||
import static org.openbw.bwapi4j.type.UnitCommandType.Morph; | ||
import static org.openbw.bwapi4j.type.UnitType.Zerg_Hive; | ||
|
||
import org.openbw.bwapi4j.type.UnitType; | ||
import org.openbw.bwapi4j.type.UpgradeType; | ||
public class Lair extends ZergResourceDepotImpl { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be only formatting changes with this file. This formatting does not match the rest of the codebase. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, sorry my mistake. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't agree here. I'm actually using the Currently you'll have to check if you supposed Unless there's an additional benefit, this is just toggling code back and forth. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The proposed scheme would have 4 different types of checks that could be accomplished with a single comparison (If something is a With the current arrangement, with a single check, one can filter a More importantly, I think it is not intuitive to check if a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're repeating our discord chat :) There's no objective benefit doing it either way. And I believe every change breaking API should have one. |
||
|
||
protected Lair(int id, int timeSpotted) { | ||
|
||
super(id, UnitType.Zerg_Lair, timeSpotted); | ||
} | ||
|
||
public class Lair extends Hatchery { | ||
protected Lair(int id, int timeSpotted) { | ||
super(id, UnitType.Zerg_Lair, timeSpotted); | ||
} | ||
protected Lair(int id, UnitType type, int timeSpotted) { | ||
|
||
protected Lair(int id, UnitType type, int timeSpotted) { | ||
super(id, type, timeSpotted); | ||
} | ||
super(id, type, timeSpotted); | ||
} | ||
|
||
|
||
public boolean upgradeVentralSacs() { | ||
|
||
return super.upgrade(UpgradeType.Ventral_Sacs); | ||
} | ||
|
||
@Override | ||
public boolean isReadyForResources() { | ||
return true; | ||
} | ||
public boolean upgradeAntennae() { | ||
|
||
public boolean upgradeVentralSacs() { | ||
return super.upgrade(UpgradeType.Ventral_Sacs); | ||
} | ||
return super.upgrade(UpgradeType.Antennae); | ||
} | ||
|
||
public boolean upgradeAntennae() { | ||
return super.upgrade(UpgradeType.Antennae); | ||
} | ||
public boolean upgradePneumatizedCarapace() { | ||
|
||
public boolean upgradePneumatizedCarapace() { | ||
return super.upgrade(UpgradeType.Pneumatized_Carapace); | ||
} | ||
return super.upgrade(UpgradeType.Pneumatized_Carapace); | ||
} | ||
|
||
@Override | ||
public boolean morph(UnitType type) { | ||
if (type != Zerg_Hive) { | ||
throw new IllegalArgumentException("Cannot morph to " + type); | ||
@Override | ||
public boolean morph(UnitType type) { | ||
if (type != Zerg_Hive) { | ||
throw new IllegalArgumentException("Cannot morph to " + type); | ||
} | ||
return issueCommand(this.id, Morph, -1, -1, -1, Zerg_Hive.getId()); | ||
} | ||
return issueCommand(this.id, Morph, -1, -1, -1, Zerg_Hive.getId()); | ||
} | ||
|
||
@Override | ||
public boolean morph() { | ||
return morph(Zerg_Hive); | ||
} | ||
@Override | ||
public boolean morph() { | ||
return morph(Zerg_Hive); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will throw an exception if it fails to match suitable base locations to all starting locations. Lots of maps play around with start locations and observer player starting locations. So, this change breaks more than it fixes, IMO. If the intent of this change is so the user is not required to manually invoke this function during the bot's initialization stages, the thrown exception needs to be removed or dealt with. As something to consider, BWEM generates a list of starting locations not assigned to bases if the function fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, I'll withdraw this proposal. Was just struck by how user-unfriendly it was to have an
initialize()
then have to manually do something that seems like core functionality, not an option.