Skip to content

Commit

Permalink
Release 0.6.5.1 -- Few changes
Browse files Browse the repository at this point in the history
- The server runs at more regular intervals.
- The server can now resend all data to the client
- The server can modify cards after they've initially been sent to clients
  • Loading branch information
OldManAlpha committed Sep 26, 2022
1 parent d8cb8fa commit 12a6767
Show file tree
Hide file tree
Showing 17 changed files with 279 additions and 187 deletions.
2 changes: 1 addition & 1 deletion client/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>monopolydeal</artifactId>
<groupId>oldmana</groupId>
<version>0.6.5</version>
<version>0.6.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mdclient</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>monopolydeal</artifactId>
<groupId>oldmana</groupId>
<version>0.6.5</version>
<version>0.6.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
61 changes: 33 additions & 28 deletions client/src/main/java/oldmana/md/client/MDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class MDClient
{
private static MDClient instance;

public static final String VERSION = "0.6.5";
public static final String VERSION = "0.6.5.1";

private MDFrame window;

Expand Down Expand Up @@ -500,40 +500,45 @@ public void disconnect(String reason, boolean closing)
}
if (!closing)
{
getGameState().setActionState(null);

if (eventQueue.getCurrentTask() instanceof CardMove)
{
removeTableComponent(((CardMove) eventQueue.getCurrentTask()).getComponent());
}
eventQueue.clearTasks();

awaitingResponse = false;
getTableScreen().getDeck().setCollection(null);
getTableScreen().getDiscardPile().setCollection(null);
getTableScreen().getVoidCollection().setCollection(null);
getTableScreen().getHand().setCollection(null);
deck = null;
discard = null;
voidCollection = null;

for (Player p : getAllPlayers())
{
removeTableComponent(p.getUI());
}
thePlayer = null;
otherPlayers.clear();
resetGame();

timeSincePing = 0;

Card.getRegisteredCards().clear();
CardCollection.getRegisteredCardCollections().clear();
PropertyColor.clearColors();

getWindow().displayMenu();
}
}

public void resetGame()
{
getGameState().setActionState(null);

if (eventQueue.getCurrentTask() instanceof CardMove)
{
removeTableComponent(((CardMove) eventQueue.getCurrentTask()).getComponent());
}
eventQueue.clearTasks();

awaitingResponse = false;
getTableScreen().getDeck().reset();
getTableScreen().getDiscardPile().reset();
getTableScreen().getVoidCollection().reset();
getTableScreen().getHand().reset();
deck = null;
discard = null;
voidCollection = null;

for (Player p : getAllPlayers())
{
removeTableComponent(p.getUI());
}
thePlayer = null;
otherPlayers.clear();

Card.getRegisteredCards().clear();
CardCollection.getRegisteredCardCollections().clear();
PropertyColor.clearColors();
}

public static MDClient getInstance()
{
return instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ public class CardActionRent extends CardAction
{
private PropertyColor[] colors;

public CardActionRent(int id, int value, String name, PropertyColor[] colors, CardDescription description)
public CardActionRent(int id, int value, String name)
{
super(id, value, name);
this.colors = colors;
setDescription(description);
}

public PropertyColor[] getRentColors()
{
return colors;
}

public void setRentColors(PropertyColor[] colors)
{
this.colors = colors;
}

@Override
public String toString()
{
Expand Down
13 changes: 11 additions & 2 deletions client/src/main/java/oldmana/md/client/card/CardProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ public CardProperty(int id, PropertyColor color, int value, String name)
base = true;
}

public CardProperty(int id, List<PropertyColor> colors, boolean base, int value, String name, CardDescription description)
public CardProperty(int id, List<PropertyColor> colors, boolean base, int value, String name)
{
super(id, value, name);
this.colors = colors;
this.base = base;
setDescription(description);
}

public boolean isSingleColor()
Expand All @@ -47,6 +46,11 @@ public boolean isBase()
return base;
}

public void setBase(boolean base)
{
this.base = base;
}

public PropertyColor getColor()
{
return colors.get(0);
Expand All @@ -62,6 +66,11 @@ public boolean hasColor(PropertyColor color)
return colors.contains(color);
}

public void setColors(List<PropertyColor> colors)
{
this.colors = colors;
}

public static class PropertyColor
{
private static List<PropertyColor> colors = new ArrayList<PropertyColor>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public abstract class MDCardCollectionBase extends MDComponent

public MDCardCollectionBase(CardCollection collection, double scale)
{
super();
this.collection = collection;
this.scale = scale;
}
Expand All @@ -33,6 +32,14 @@ public void setCollection(CardCollection collection)
this.collection = collection;
}

public void reset()
{
setCollection(null);
setModification(null);
modIndex = -1;
moveProgress = 0;
}

public int getCardCount()
{
return collection.getCardCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

public class MDVoidCollection extends MDCardCollectionUnknown
{
private int stage; // Range: 0(invisible) to 500(fully visible)
private double stage; // Range: 0(invisible) to 500(fully visible)
private double pos; // Range: -350 to 350
private boolean dir;

private int intoVoidTime;
private double intoVoidTime;

public MDVoidCollection(CardCollection collection)
{
Expand All @@ -28,6 +28,8 @@ public MDVoidCollection(CardCollection collection)
{
if (getCollection() == null)
{
stage = 0;
intoVoidTime = 0;
return;
}

Expand All @@ -41,16 +43,16 @@ public MDVoidCollection(CardCollection collection)

if (isCardIncoming() || isCardMovingFrom() || getClient().isDebugEnabled() || intoVoidTime > 0)
{
stage = (int) Math.min(500, stage + MDScheduler.getFrameDelay());
stage = Math.min(500, stage + MDScheduler.getFrameDelay());
repaint();
}
else if (stage > 0)
{
stage = (int) Math.max(0, stage - MDScheduler.getFrameDelay());
stage = Math.max(0, stage - MDScheduler.getFrameDelay());
repaint();
}

intoVoidTime = (int) Math.max(intoVoidTime - MDScheduler.getFrameDelay(), 0);
intoVoidTime = Math.max(intoVoidTime - MDScheduler.getFrameDelay(), 0);
});
}

Expand Down Expand Up @@ -97,7 +99,7 @@ public void paintComponent(Graphics gr)
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.rotate(Math.toRadians(pos / 20), getWidth() / 2, getHeight() / 2);
g.setColor(new Color(0, 0, 40));
double size = (double) stage / 500;
double size = stage / 500;
g.fillRoundRect((getWidth() / 2) - (int) (GraphicsUtils.getCardWidth() * size * 0.5), (getHeight() / 2) -
(int) (GraphicsUtils.getCardHeight() * size * 0.5), (int) (GraphicsUtils.getCardWidth() * size),
(int) (GraphicsUtils.getCardHeight() * size), scale(10 * size), scale(10 * size));
Expand Down
37 changes: 33 additions & 4 deletions client/src/main/java/oldmana/md/client/net/NetClientHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ public void handleHandshake(PacketHandshake packet)
client.sendPacket(new PacketSoundCache(soundNames, soundHashes));
}

public void handleRefresh(PacketRefresh packet)
{
client.resetGame();
}

public void handlePropertyColors(PacketPropertyColors packet)
{
int len = packet.name.length;
Expand Down Expand Up @@ -206,6 +211,7 @@ public void handleCardData(PacketCardData packet)
{
card.setValue(packet.value);
card.setName(packet.name);
card.clearGraphicsCache();
}
else
{
Expand All @@ -226,14 +232,37 @@ public void handleCardData(PacketCardData packet)

public void handleCardActionRentData(PacketCardActionRentData packet)
{
new CardActionRent(packet.id, packet.value, packet.name, PropertyColor.fromIDs(packet.colors).toArray(new PropertyColor[packet.colors.length]),
CardDescription.getDescriptionByID(packet.description));
CardActionRent card;
if ((card = (CardActionRent) Card.getCard(packet.id)) != null)
{
card.setValue(packet.value);
card.setName(packet.name);
card.clearGraphicsCache();
}
else
{
card = new CardActionRent(packet.id, packet.value, packet.name);
}
card.setRentColors(PropertyColor.fromIDs(packet.colors).toArray(new PropertyColor[packet.colors.length]));
card.setDescription(CardDescription.getDescriptionByID(packet.description));
}

public void handleCardPropertyData(PacketCardPropertyData packet)
{
new CardProperty(packet.id, PropertyColor.fromIDs(packet.colors), packet.base, packet.value, packet.name,
CardDescription.getDescriptionByID(packet.description));
CardProperty card;
if ((card = (CardProperty) Card.getCard(packet.id)) != null)
{
card.setValue(packet.value);
card.setName(packet.name);
card.clearGraphicsCache();
}
else
{
card = new CardProperty(packet.id, PropertyColor.fromIDs(packet.colors), packet.base, packet.value, packet.name);
}
card.setBase(packet.base);
card.setColors(PropertyColor.fromIDs(packet.colors));
card.setDescription(CardDescription.getDescriptionByID(packet.description));
}

public void handleCardBuildingData(PacketCardBuildingData packet)
Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>monopolydeal</artifactId>
<groupId>oldmana</groupId>
<version>0.6.5</version>
<version>0.6.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>oldmana</groupId>
<artifactId>monopolydeal</artifactId>
<packaging>pom</packaging>
<version>0.6.5</version>
<version>0.6.5.1</version>
<modules>
<module>client</module>
<module>server</module>
Expand Down
2 changes: 1 addition & 1 deletion server/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>monopolydeal</artifactId>
<groupId>oldmana</groupId>
<version>0.6.5</version>
<version>0.6.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mdserver</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>monopolydeal</artifactId>
<groupId>oldmana</groupId>
<version>0.6.5</version>
<version>0.6.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading

0 comments on commit 12a6767

Please sign in to comment.