first, and last commit
This commit is contained in:
commit
967abdba8f
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
target
|
||||
Monopoly.iml
|
BIN
monopoly.png
Normal file
BIN
monopoly.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 274 KiB |
699
monopoly.uml
Normal file
699
monopoly.uml
Normal file
@ -0,0 +1,699 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Diagram>
|
||||
<ID>JAVA</ID>
|
||||
<OriginalElement />
|
||||
<nodes>
|
||||
<node x="2324.398587801597" y="33.0">de.joethei.monopoly.colors.ConsoleColor</node>
|
||||
<node x="2655.849210394384" y="218.0">de.joethei.monopoly.colors.UnderlinedColor</node>
|
||||
<node x="1770.8492103943838" y="207.0">de.joethei.monopoly.colors.BackgroundBrightColor</node>
|
||||
<node x="0.0" y="3063.0">de.joethei.monopoly.colors.BoldBrightColor</node>
|
||||
<node x="391.9374999999999" y="1128.0">de.joethei.monopoly.fields.TrainStation</node>
|
||||
<node x="2499.0827380952383" y="2789.0">de.joethei.monopoly.Player</node>
|
||||
<node x="1190.648587801597" y="295.5">de.joethei.monopoly.actions.BuildHouseAction</node>
|
||||
<node x="662.2652544682634" y="1128.0">de.joethei.monopoly.fields.Factory</node>
|
||||
<node x="2086.273587801597" y="1083.0">de.joethei.monopoly.action.Card</node>
|
||||
<node x="1125.648587801597" y="1128.0">de.joethei.monopoly.fields.Event</node>
|
||||
<node x="1712.122048246381" y="688.0">de.joethei.monopoly.fields.Street</node>
|
||||
<node x="1327.648587801597" y="1128.0">de.joethei.monopoly.fields.Tax</node>
|
||||
<node x="2038.8492103943838" y="207.0">de.joethei.monopoly.colors.NormalColor</node>
|
||||
<node x="1437.3581593574922" y="1414.0">de.joethei.monopoly.Monopoly</node>
|
||||
<node x="126.58514348447625" y="1956.0">de.joethei.monopoly.action.Action</node>
|
||||
<node x="671.2652544682634" y="0.0">de.joethei.monopoly.action.ActionType</node>
|
||||
<node x="2873.849210394384" y="207.0">de.joethei.monopoly.colors.BoldColor</node>
|
||||
<node x="837.8492103943839" y="2331.0">de.joethei.monopoly.fields.Field</node>
|
||||
<node x="343.4999999999999" y="295.5">de.joethei.monopoly.actions.BuyFieldAction</node>
|
||||
<node x="1237.6979166666665" y="2590.0">de.joethei.monopoly.fields.OwnableField</node>
|
||||
<node x="1549.122048246381" y="1128.0">de.joethei.monopoly.CircularLinkedList</node>
|
||||
<node x="953.1485878015967" y="1128.0">de.joethei.monopoly.fields.FreeParking</node>
|
||||
<node x="660.5208333333333" y="889.0">de.joethei.monopoly.actions.SellFieldAction</node>
|
||||
<node x="120.5" y="284.0">de.joethei.monopoly.actions.PayRentAction</node>
|
||||
<node x="2239.849210394384" y="207.0">de.joethei.monopoly.colors.BackgroundColor</node>
|
||||
<node x="2463.849210394384" y="207.0">de.joethei.monopoly.colors.BrightColor</node>
|
||||
<node x="2311.273587801597" y="1128.0">de.joethei.monopoly.fields.Jail</node>
|
||||
</nodes>
|
||||
<notes />
|
||||
<edges>
|
||||
<edge source="de.joethei.monopoly.actions.BuildHouseAction" target="de.joethei.monopoly.Player">
|
||||
<point x="87.9375" y="37.0" />
|
||||
<point x="1379.086087801597" y="488.0" />
|
||||
<point x="2672.5827380952383" y="488.0" />
|
||||
<point x="2672.5827380952383" y="2769.0" />
|
||||
<point x="2674.5827380952383" y="2769.0" />
|
||||
<point x="65.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuildHouseAction" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="-87.9375" y="37.0" />
|
||||
<point x="1203.211087801597" y="638.0" />
|
||||
<point x="44.0" y="638.0" />
|
||||
<point x="44.0" y="2550.0" />
|
||||
<point x="1273.9479166666665" y="2550.0" />
|
||||
<point x="-65.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuyFieldAction" target="de.joethei.monopoly.action.ActionType">
|
||||
<point x="0.0" y="-37.0" />
|
||||
<point x="435.9999999999999" y="177.0" />
|
||||
<point x="726.8763655793745" y="177.0" />
|
||||
<point x="-15.888888888888914" y="58.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Event" target="de.joethei.monopoly.action.ActionType">
|
||||
<point x="0.0" y="-25.5" />
|
||||
<point x="1180.148587801597" y="187.0" />
|
||||
<point x="758.6541433571523" y="187.0" />
|
||||
<point x="15.888888888888914" y="58.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Street" target="de.joethei.monopoly.colors.NormalColor">
|
||||
<point x="102.42857142857156" y="-70.5" />
|
||||
<point x="1934.0506196749525" y="638.0" />
|
||||
<point x="2068.8492103943836" y="638.0" />
|
||||
<point x="-60.0" y="125.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Street" target="de.joethei.monopoly.actions.SellFieldAction">
|
||||
<point x="-68.28571428571422" y="70.5" />
|
||||
<point x="1763.3363339606667" y="859.0" />
|
||||
<point x="813.0208333333333" y="859.0" />
|
||||
<point x="61.0" y="-37.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Player" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="-65.0" y="-114.5" />
|
||||
<point x="2544.5827380952383" y="2739.0" />
|
||||
<point x="1288.4479166666665" y="2739.0" />
|
||||
<point x="-50.75" y="59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.Event">
|
||||
<point x="-105.72222222222229" y="-191.0" />
|
||||
<point x="1504.6359371352698" y="1324.0" />
|
||||
<point x="1189.2319211349302" y="1324.0" />
|
||||
<point x="9.083333333333371" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="67.27777777777771" y="-191.0" />
|
||||
<point x="1677.6359371352698" y="1344.0" />
|
||||
<point x="1972.622048246381" y="1344.0" />
|
||||
<point x="1972.622048246381" y="658.0" />
|
||||
<point x="2229.3492103943836" y="658.0" />
|
||||
<point x="2229.3492103943836" y="177.0" />
|
||||
<point x="2382.489496892506" y="177.0" />
|
||||
<point x="-12.909090909090992" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Tax" target="de.joethei.monopoly.action.ActionType">
|
||||
<point x="0.0" y="-25.5" />
|
||||
<point x="1402.148587801597" y="167.0" />
|
||||
<point x="790.4319211349301" y="167.0" />
|
||||
<point x="47.66666666666674" y="58.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Factory" target="de.joethei.monopoly.actions.SellFieldAction">
|
||||
<point x="56.66666666666674" y="-25.5" />
|
||||
<point x="803.9319211349301" y="1013.0" />
|
||||
<point x="752.0208333333333" y="1013.0" />
|
||||
<point x="0.0" y="37.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Player" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="104.0" y="-114.5" />
|
||||
<point x="2713.5827380952383" y="2769.0" />
|
||||
<point x="3059.349210394384" y="2769.0" />
|
||||
<point x="3059.349210394384" y="147.0" />
|
||||
<point x="2459.9440423470514" y="147.0" />
|
||||
<point x="64.5454545454545" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Street" target="de.joethei.monopoly.actions.PayRentAction">
|
||||
<point x="-102.42857142857156" y="-70.5" />
|
||||
<point x="1729.1934768178094" y="538.0" />
|
||||
<point x="310.8125" y="538.0" />
|
||||
<point x="88.8125" y="48.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.TrainStation" target="de.joethei.monopoly.actions.PayRentAction">
|
||||
<point x="-65.0" y="-25.5" />
|
||||
<point x="424.4374999999999" y="1063.0" />
|
||||
<point x="334.4999999999999" y="1063.0" />
|
||||
<point x="334.4999999999999" y="588.0" />
|
||||
<point x="234.6875" y="588.0" />
|
||||
<point x="12.6875" y="48.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.TrainStation" target="de.joethei.monopoly.actions.SellFieldAction">
|
||||
<point x="65.0" y="-25.5" />
|
||||
<point x="554.4374999999999" y="1043.0" />
|
||||
<point x="673.5922619047619" y="1043.0" />
|
||||
<point x="-78.42857142857133" y="37.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.PayRentAction" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="63.4375" y="48.5" />
|
||||
<point x="285.4375" y="558.0" />
|
||||
<point x="933.1485878015967" y="558.0" />
|
||||
<point x="933.1485878015967" y="2181.0" />
|
||||
<point x="899.5992103943839" y="2181.0" />
|
||||
<point x="-33.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Factory" target="de.joethei.monopoly.actions.BuyFieldAction">
|
||||
<point x="0.0" y="-25.5" />
|
||||
<point x="747.2652544682634" y="1023.0" />
|
||||
<point x="650.0208333333333" y="1023.0" />
|
||||
<point x="650.0208333333333" y="568.0" />
|
||||
<point x="470.6874999999999" y="568.0" />
|
||||
<point x="34.6875" y="37.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuildHouseAction" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="-12.5625" y="37.0" />
|
||||
<point x="1278.586087801597" y="668.0" />
|
||||
<point x="1105.6485878015967" y="668.0" />
|
||||
<point x="1105.6485878015967" y="2221.0" />
|
||||
<point x="937.5992103943839" y="2221.0" />
|
||||
<point x="4.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.SellFieldAction" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="52.28571428571445" y="37.0" />
|
||||
<point x="804.3065476190477" y="993.0" />
|
||||
<point x="918.2319211349301" y="993.0" />
|
||||
<point x="918.2319211349301" y="2171.0" />
|
||||
<point x="890.0992103943839" y="2171.0" />
|
||||
<point x="-42.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.TrainStation" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="24.375" y="25.5" />
|
||||
<point x="513.8124999999999" y="1374.0" />
|
||||
<point x="466.77681015114285" y="1374.0" />
|
||||
<point x="466.77681015114285" y="2281.0" />
|
||||
<point x="871.0992103943839" y="2281.0" />
|
||||
<point x="-61.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.OwnableField" target="de.joethei.monopoly.Player">
|
||||
<point x="50.75" y="59.5" />
|
||||
<point x="1389.9479166666665" y="2729.0" />
|
||||
<point x="2557.5827380952383" y="2729.0" />
|
||||
<point x="-52.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.PayRentAction" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="-63.4375" y="48.5" />
|
||||
<point x="158.5625" y="588.0" />
|
||||
<point x="22.0" y="588.0" />
|
||||
<point x="22.0" y="2570.0" />
|
||||
<point x="1244.9479166666665" y="2570.0" />
|
||||
<point x="-94.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="21.625" y="191.0" />
|
||||
<point x="1631.9831593574922" y="1926.0" />
|
||||
<point x="2540.9577380952383" y="1926.0" />
|
||||
<point x="2540.9577380952383" y="2550.0" />
|
||||
<point x="1404.4479166666665" y="2550.0" />
|
||||
<point x="65.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.colors.BrightColor">
|
||||
<point x="86.5" y="-191.0" />
|
||||
<point x="1696.8581593574922" y="1354.0" />
|
||||
<point x="2066.898587801597" y="1354.0" />
|
||||
<point x="2066.898587801597" y="668.0" />
|
||||
<point x="2549.849210394384" y="668.0" />
|
||||
<point x="0.0" y="125.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Street" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="-34.14285714285734" y="70.5" />
|
||||
<point x="1797.4791911035236" y="869.0" />
|
||||
<point x="1115.1485878015967" y="869.0" />
|
||||
<point x="1115.1485878015967" y="2231.0" />
|
||||
<point x="947.0992103943839" y="2231.0" />
|
||||
<point x="14.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.action.Card">
|
||||
<point x="124.94444444444446" y="-191.0" />
|
||||
<point x="1735.3026038019366" y="1374.0" />
|
||||
<point x="2188.773587801597" y="1374.0" />
|
||||
<point x="-1.4210854715202004E-14" y="70.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.CircularLinkedList">
|
||||
<point x="-28.83333333333337" y="-191.0" />
|
||||
<point x="1581.5248260241588" y="1294.0" />
|
||||
<point x="1620.122048246381" y="1294.0" />
|
||||
<point x="0.0" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.Player">
|
||||
<point x="64.875" y="191.0" />
|
||||
<point x="1675.2331593574922" y="1916.0" />
|
||||
<point x="2584.5827380952383" y="1916.0" />
|
||||
<point x="2584.5827380952383" y="2739.0" />
|
||||
<point x="2570.5827380952383" y="2739.0" />
|
||||
<point x="-39.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.SellFieldAction" target="de.joethei.monopoly.action.Action">
|
||||
<point x="26.14285714285711" y="37.0" />
|
||||
<point x="778.1636904761904" y="1003.0" />
|
||||
<point x="842.7652544682634" y="1003.0" />
|
||||
<point x="842.7652544682634" y="1876.0" />
|
||||
<point x="281.11847681780955" y="1876.0" />
|
||||
<point x="32.5333333333333" y="-92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.action.Action" target="de.joethei.monopoly.action.ActionType">
|
||||
<point x="-97.60000000000014" y="-92.5" />
|
||||
<point x="150.9851434844761" y="1846.0" />
|
||||
<point x="110.0" y="1846.0" />
|
||||
<point x="110.0" y="157.0" />
|
||||
<point x="695.0985878015966" y="157.0" />
|
||||
<point x="-47.66666666666674" y="58.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.PayRentAction" target="de.joethei.monopoly.Player">
|
||||
<point x="-88.8125" y="48.5" />
|
||||
<point x="133.1875" y="578.0" />
|
||||
<point x="0.0" y="578.0" />
|
||||
<point x="0.0" y="2769.0" />
|
||||
<point x="2505.5827380952383" y="2769.0" />
|
||||
<point x="-104.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuyFieldAction" target="de.joethei.monopoly.Player">
|
||||
<point x="-80.9375" y="37.0" />
|
||||
<point x="355.0624999999999" y="598.0" />
|
||||
<point x="11.0" y="598.0" />
|
||||
<point x="11.0" y="2759.0" />
|
||||
<point x="2518.5827380952383" y="2759.0" />
|
||||
<point x="-91.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.action.Card" target="de.joethei.monopoly.Player">
|
||||
<point x="68.33333333333337" y="70.5" />
|
||||
<point x="2257.1069211349304" y="1254.0" />
|
||||
<point x="2639.5827380952383" y="1254.0" />
|
||||
<point x="2639.5827380952383" y="2769.0" />
|
||||
<point x="2635.5827380952383" y="2769.0" />
|
||||
<point x="26.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Street" target="de.joethei.monopoly.actions.BuyFieldAction">
|
||||
<point x="-68.28571428571422" y="-70.5" />
|
||||
<point x="1763.3363339606667" y="528.0" />
|
||||
<point x="516.9374999999999" y="528.0" />
|
||||
<point x="80.9375" y="37.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Event" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="-9.083333333333371" y="25.5" />
|
||||
<point x="1171.0652544682634" y="2251.0" />
|
||||
<point x="966.0992103943839" y="2251.0" />
|
||||
<point x="33.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuildHouseAction" target="de.joethei.monopoly.action.Action">
|
||||
<point x="-37.6875" y="37.0" />
|
||||
<point x="1253.461087801597" y="658.0" />
|
||||
<point x="608.4374999999999" y="658.0" />
|
||||
<point x="608.4374999999999" y="1846.0" />
|
||||
<point x="248.58514348447625" y="1846.0" />
|
||||
<point x="0.0" y="-92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Tax" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="37.25" y="25.5" />
|
||||
<point x="1439.398587801597" y="1284.0" />
|
||||
<point x="2360.023587801597" y="1284.0" />
|
||||
<point x="2360.023587801597" y="2291.0" />
|
||||
<point x="1004.0992103943839" y="2291.0" />
|
||||
<point x="71.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuildHouseAction" target="de.joethei.monopoly.Monopoly">
|
||||
<point x="12.5625" y="37.0" />
|
||||
<point x="1303.711087801597" y="668.0" />
|
||||
<point x="1701.622048246381" y="668.0" />
|
||||
<point x="1701.622048246381" y="1304.0" />
|
||||
<point x="1600.747048246381" y="1304.0" />
|
||||
<point x="-9.6111111111112" y="-191.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.Street">
|
||||
<point x="9.611111111111086" y="-191.0" />
|
||||
<point x="1619.969270468603" y="1314.0" />
|
||||
<point x="1831.622048246381" y="1314.0" />
|
||||
<point x="0.0" y="70.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Tax" target="de.joethei.monopoly.action.Action">
|
||||
<point x="-62.083333333333314" y="25.5" />
|
||||
<point x="1340.0652544682634" y="1384.0" />
|
||||
<point x="864.7652544682634" y="1384.0" />
|
||||
<point x="864.7652544682634" y="1896.0" />
|
||||
<point x="313.65181015114285" y="1896.0" />
|
||||
<point x="65.0666666666666" y="-92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuildHouseAction" target="de.joethei.monopoly.action.ActionType">
|
||||
<point x="0.0" y="-37.0" />
|
||||
<point x="1291.148587801597" y="177.0" />
|
||||
<point x="774.5430322460412" y="177.0" />
|
||||
<point x="31.77777777777783" y="58.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.action.Action" target="de.joethei.monopoly.Monopoly">
|
||||
<point x="81.33333333333326" y="-92.5" />
|
||||
<point x="329.9184768178095" y="1906.0" />
|
||||
<point x="1458.9831593574922" y="1906.0" />
|
||||
<point x="-151.375" y="191.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.colors.BrightColor" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="0.0" y="-125.5" />
|
||||
<point x="2549.849210394384" y="187.0" />
|
||||
<point x="2408.307678710688" y="187.0" />
|
||||
<point x="12.909090909090992" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Field" target="de.joethei.monopoly.action.Action">
|
||||
<point x="-90.25" y="-59.5" />
|
||||
<point x="842.5992103943839" y="2311.0" />
|
||||
<point x="248.58514348447625" y="2311.0" />
|
||||
<point x="0.0" y="92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Street" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="102.42857142857156" y="70.5" />
|
||||
<point x="1934.0506196749525" y="859.0" />
|
||||
<point x="2570.2077380952383" y="859.0" />
|
||||
<point x="2570.2077380952383" y="2570.0" />
|
||||
<point x="1433.4479166666665" y="2570.0" />
|
||||
<point x="94.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Jail" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="8.0" y="25.5" />
|
||||
<point x="2367.273587801597" y="1394.0" />
|
||||
<point x="2369.523587801597" y="1394.0" />
|
||||
<point x="2369.523587801597" y="2301.0" />
|
||||
<point x="1013.5992103943839" y="2301.0" />
|
||||
<point x="80.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Street" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="68.28571428571422" y="-70.5" />
|
||||
<point x="1899.9077625320951" y="628.0" />
|
||||
<point x="2028.3492103943838" y="628.0" />
|
||||
<point x="2028.3492103943838" y="157.0" />
|
||||
<point x="2356.6713150743244" y="157.0" />
|
||||
<point x="-38.72727272727252" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Jail" target="de.joethei.monopoly.Monopoly">
|
||||
<point x="-24.0" y="25.5" />
|
||||
<point x="2335.273587801597" y="1394.0" />
|
||||
<point x="1773.747048246381" y="1394.0" />
|
||||
<point x="163.3888888888889" y="-191.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.Factory">
|
||||
<point x="-144.16666666666674" y="-191.0" />
|
||||
<point x="1466.1914926908253" y="1344.0" />
|
||||
<point x="811.0152544682634" y="1344.0" />
|
||||
<point x="63.75" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.action.Action" target="de.joethei.monopoly.Player">
|
||||
<point x="-97.59999999999991" y="92.5" />
|
||||
<point x="150.98514348447634" y="2311.0" />
|
||||
<point x="125.2851434844763" y="2311.0" />
|
||||
<point x="125.2851434844763" y="2749.0" />
|
||||
<point x="2531.5827380952383" y="2749.0" />
|
||||
<point x="-78.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Event" target="de.joethei.monopoly.Monopoly">
|
||||
<point x="27.25" y="25.5" />
|
||||
<point x="1207.398587801597" y="1314.0" />
|
||||
<point x="1523.858159357492" y="1314.0" />
|
||||
<point x="-86.50000000000011" y="-191.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.colors.NormalColor" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="0.0" y="-125.5" />
|
||||
<point x="2128.8492103943836" y="167.0" />
|
||||
<point x="2369.580405983415" y="167.0" />
|
||||
<point x="-25.818181818181984" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Jail" target="de.joethei.monopoly.Player">
|
||||
<point x="40.000000000000114" y="25.5" />
|
||||
<point x="2399.273587801597" y="1244.0" />
|
||||
<point x="2650.5827380952383" y="1244.0" />
|
||||
<point x="2650.5827380952383" y="2769.0" />
|
||||
<point x="2648.5827380952383" y="2769.0" />
|
||||
<point x="39.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.colors.UnderlinedColor" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="0.0" y="-114.5" />
|
||||
<point x="2754.849210394384" y="177.0" />
|
||||
<point x="2421.216769619779" y="177.0" />
|
||||
<point x="25.818181818181984" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.FreeParking">
|
||||
<point x="-124.94444444444446" y="-191.0" />
|
||||
<point x="1485.4137149130477" y="1334.0" />
|
||||
<point x="1071.48192113493" y="1334.0" />
|
||||
<point x="47.33333333333337" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Tax" target="de.joethei.monopoly.Monopoly">
|
||||
<point x="12.416666666666657" y="25.5" />
|
||||
<point x="1414.5652544682634" y="1294.0" />
|
||||
<point x="1562.3026038019366" y="1294.0" />
|
||||
<point x="-48.05555555555554" y="-191.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="-64.875" y="191.0" />
|
||||
<point x="1545.4831593574922" y="1926.0" />
|
||||
<point x="1444.4484371352698" y="1926.0" />
|
||||
<point x="1444.4484371352698" y="2271.0" />
|
||||
<point x="985.0992103943839" y="2271.0" />
|
||||
<point x="52.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuyFieldAction" target="de.joethei.monopoly.action.Action">
|
||||
<point x="-11.5625" y="37.0" />
|
||||
<point x="424.4374999999999" y="628.0" />
|
||||
<point x="312.5" y="628.0" />
|
||||
<point x="312.5" y="1826.0" />
|
||||
<point x="216.05181015114294" y="1826.0" />
|
||||
<point x="-32.5333333333333" y="-92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Player" target="de.joethei.monopoly.colors.NormalColor">
|
||||
<point x="78.0" y="-114.5" />
|
||||
<point x="2687.5827380952383" y="2769.0" />
|
||||
<point x="2683.5827380952383" y="2769.0" />
|
||||
<point x="2683.5827380952383" y="478.0" />
|
||||
<point x="2188.8492103943836" y="478.0" />
|
||||
<point x="60.0" y="125.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.colors.BackgroundColor" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="0.0" y="-125.5" />
|
||||
<point x="2341.849210394384" y="187.0" />
|
||||
<point x="2395.398587801597" y="187.0" />
|
||||
<point x="0.0" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Event" target="de.joethei.monopoly.Player">
|
||||
<point x="45.41666666666663" y="25.5" />
|
||||
<point x="1225.5652544682634" y="1274.0" />
|
||||
<point x="2617.5827380952383" y="1274.0" />
|
||||
<point x="2617.5827380952383" y="2769.0" />
|
||||
<point x="2609.5827380952383" y="2769.0" />
|
||||
<point x="0.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.SellFieldAction" target="de.joethei.monopoly.action.ActionType">
|
||||
<point x="-61.0" y="-37.0" />
|
||||
<point x="691.0208333333333" y="869.0" />
|
||||
<point x="676.0208333333333" y="869.0" />
|
||||
<point x="676.0208333333333" y="187.0" />
|
||||
<point x="742.7652544682634" y="187.0" />
|
||||
<point x="0.0" y="58.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.colors.NormalColor">
|
||||
<point x="48.05555555555554" y="-191.0" />
|
||||
<point x="1658.4137149130477" y="1334.0" />
|
||||
<point x="1961.622048246381" y="1334.0" />
|
||||
<point x="1961.622048246381" y="648.0" />
|
||||
<point x="2128.8492103943836" y="648.0" />
|
||||
<point x="0.0" y="125.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Factory" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="-21.25" y="25.5" />
|
||||
<point x="726.0152544682634" y="1866.0" />
|
||||
<point x="102.33514348447625" y="1866.0" />
|
||||
<point x="102.33514348447625" y="2500.0" />
|
||||
<point x="1346.4479166666665" y="2500.0" />
|
||||
<point x="7.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.SellFieldAction" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="-52.28571428571422" y="37.0" />
|
||||
<point x="699.735119047619" y="1053.0" />
|
||||
<point x="597.4374999999999" y="1053.0" />
|
||||
<point x="597.4374999999999" y="1384.0" />
|
||||
<point x="77.0" y="1384.0" />
|
||||
<point x="77.0" y="2520.0" />
|
||||
<point x="1317.4479166666665" y="2520.0" />
|
||||
<point x="-21.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.TrainStation">
|
||||
<point x="-163.38888888888897" y="-191.0" />
|
||||
<point x="1446.969270468603" y="1354.0" />
|
||||
<point x="562.5624999999999" y="1354.0" />
|
||||
<point x="73.125" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.action.Action" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="48.799999999999955" y="92.5" />
|
||||
<point x="297.3851434844762" y="2301.0" />
|
||||
<point x="852.0992103943839" y="2301.0" />
|
||||
<point x="-80.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.colors.BackgroundBrightColor" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="0.0" y="-125.5" />
|
||||
<point x="1888.8492103943838" y="137.0" />
|
||||
<point x="2330.8531332561424" y="137.0" />
|
||||
<point x="-64.5454545454545" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Event" target="de.joethei.monopoly.action.Action">
|
||||
<point x="-45.41666666666663" y="25.5" />
|
||||
<point x="1134.7319211349302" y="1374.0" />
|
||||
<point x="853.7652544682634" y="1374.0" />
|
||||
<point x="853.7652544682634" y="1886.0" />
|
||||
<point x="297.3851434844762" y="1886.0" />
|
||||
<point x="48.799999999999955" y="-92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Street" target="de.joethei.monopoly.actions.BuildHouseAction">
|
||||
<point x="-34.14285714285734" y="-70.5" />
|
||||
<point x="1797.4791911035236" y="518.0" />
|
||||
<point x="1328.836087801597" y="518.0" />
|
||||
<point x="37.6875" y="37.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.Tax">
|
||||
<point x="-67.27777777777783" y="-191.0" />
|
||||
<point x="1543.0803815797144" y="1304.0" />
|
||||
<point x="1389.7319211349302" y="1304.0" />
|
||||
<point x="-12.416666666666686" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.SellFieldAction" target="de.joethei.monopoly.fields.Street">
|
||||
<point x="0.0" y="-37.0" />
|
||||
<point x="752.0208333333333" y="849.0" />
|
||||
<point x="1729.1934768178094" y="849.0" />
|
||||
<point x="-102.42857142857156" y="70.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuyFieldAction" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="-57.8125" y="37.0" />
|
||||
<point x="378.1874999999999" y="608.0" />
|
||||
<point x="33.0" y="608.0" />
|
||||
<point x="33.0" y="2560.0" />
|
||||
<point x="1259.4479166666665" y="2560.0" />
|
||||
<point x="-79.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Factory" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="21.25" y="25.5" />
|
||||
<point x="768.5152544682634" y="1364.0" />
|
||||
<point x="908.7319211349301" y="1364.0" />
|
||||
<point x="908.7319211349301" y="2161.0" />
|
||||
<point x="880.5992103943839" y="2161.0" />
|
||||
<point x="-52.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.SellFieldAction" target="de.joethei.monopoly.Player">
|
||||
<point x="78.42857142857156" y="37.0" />
|
||||
<point x="830.4494047619048" y="983.0" />
|
||||
<point x="2661.5827380952383" y="983.0" />
|
||||
<point x="52.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.FreeParking" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="0.0" y="25.5" />
|
||||
<point x="1024.1485878015967" y="1364.0" />
|
||||
<point x="1010.9160714285714" y="1364.0" />
|
||||
<point x="1010.9160714285714" y="2211.0" />
|
||||
<point x="928.0992103943839" y="2211.0" />
|
||||
<point x="-4.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.TrainStation" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="-24.375" y="25.5" />
|
||||
<point x="465.0624999999999" y="1364.0" />
|
||||
<point x="66.0" y="1364.0" />
|
||||
<point x="66.0" y="2530.0" />
|
||||
<point x="1302.9479166666665" y="2530.0" />
|
||||
<point x="-36.25" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuildHouseAction" target="de.joethei.monopoly.fields.Street">
|
||||
<point x="62.8125" y="37.0" />
|
||||
<point x="1353.961087801597" y="508.0" />
|
||||
<point x="1831.622048246381" y="508.0" />
|
||||
<point x="0.0" y="-70.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Factory" target="de.joethei.monopoly.actions.PayRentAction">
|
||||
<point x="-56.66666666666674" y="-25.5" />
|
||||
<point x="690.5985878015966" y="1033.0" />
|
||||
<point x="639.0208333333333" y="1033.0" />
|
||||
<point x="639.0208333333333" y="578.0" />
|
||||
<point x="260.0625" y="578.0" />
|
||||
<point x="38.0625" y="48.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.colors.BoldColor" target="de.joethei.monopoly.colors.ConsoleColor">
|
||||
<point x="0.0" y="-125.5" />
|
||||
<point x="2955.849210394384" y="167.0" />
|
||||
<point x="2434.1258605288695" y="167.0" />
|
||||
<point x="38.72727272727252" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.PayRentAction" target="de.joethei.monopoly.action.Action">
|
||||
<point x="-38.0625" y="48.5" />
|
||||
<point x="183.9375" y="588.0" />
|
||||
<point x="176.60900446826327" y="588.0" />
|
||||
<point x="176.60900446826327" y="1856.0" />
|
||||
<point x="167.25181015114276" y="1856.0" />
|
||||
<point x="-81.33333333333348" y="-92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Jail" target="de.joethei.monopoly.action.ActionType">
|
||||
<point x="0.0" y="-25.5" />
|
||||
<point x="2359.273587801597" y="498.0" />
|
||||
<point x="1760.3492103943838" y="498.0" />
|
||||
<point x="1760.3492103943838" y="157.0" />
|
||||
<point x="806.320810023819" y="157.0" />
|
||||
<point x="63.55555555555566" y="58.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Jail" target="de.joethei.monopoly.action.Action">
|
||||
<point x="-8.0" y="25.5" />
|
||||
<point x="2351.273587801597" y="1394.0" />
|
||||
<point x="2349.023587801597" y="1394.0" />
|
||||
<point x="2349.023587801597" y="1936.0" />
|
||||
<point x="362.4518101511428" y="1936.0" />
|
||||
<point x="113.86666666666656" y="-92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.fields.Jail">
|
||||
<point x="144.16666666666663" y="-191.0" />
|
||||
<point x="1754.5248260241588" y="1384.0" />
|
||||
<point x="2319.273587801597" y="1384.0" />
|
||||
<point x="-40.0" y="25.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.TrainStation" target="de.joethei.monopoly.actions.BuyFieldAction">
|
||||
<point x="0.0" y="-25.5" />
|
||||
<point x="489.4374999999999" y="628.0" />
|
||||
<point x="447.5624999999999" y="628.0" />
|
||||
<point x="11.5625" y="37.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.Tax" target="de.joethei.monopoly.Player">
|
||||
<point x="62.083333333333314" y="25.5" />
|
||||
<point x="1464.2319211349302" y="1264.0" />
|
||||
<point x="2628.5827380952383" y="1264.0" />
|
||||
<point x="2628.5827380952383" y="2769.0" />
|
||||
<point x="2622.5827380952383" y="2769.0" />
|
||||
<point x="13.0" y="-114.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.BuyFieldAction" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="57.8125" y="37.0" />
|
||||
<point x="493.8124999999999" y="548.0" />
|
||||
<point x="942.6485878015967" y="548.0" />
|
||||
<point x="942.6485878015967" y="2191.0" />
|
||||
<point x="909.0992103943839" y="2191.0" />
|
||||
<point x="-23.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.Monopoly" target="de.joethei.monopoly.action.Action">
|
||||
<point x="-108.125" y="191.0" />
|
||||
<point x="1502.2331593574922" y="1916.0" />
|
||||
<point x="346.18514348447616" y="1916.0" />
|
||||
<point x="97.59999999999991" y="-92.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.fields.OwnableField" target="de.joethei.monopoly.fields.Field">
|
||||
<point x="50.75" y="-59.5" />
|
||||
<point x="1389.9479166666665" y="2470.0" />
|
||||
<point x="980.3492103943839" y="2470.0" />
|
||||
<point x="47.5" y="59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.action.Action" target="de.joethei.monopoly.fields.OwnableField">
|
||||
<point x="-48.799999999999955" y="92.5" />
|
||||
<point x="199.7851434844763" y="2311.0" />
|
||||
<point x="197.6601434844763" y="2311.0" />
|
||||
<point x="197.6601434844763" y="2490.0" />
|
||||
<point x="1360.9479166666665" y="2490.0" />
|
||||
<point x="21.75" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.monopoly.actions.PayRentAction" target="de.joethei.monopoly.action.ActionType">
|
||||
<point x="0.0" y="-48.5" />
|
||||
<point x="222.0" y="167.0" />
|
||||
<point x="710.9874766904856" y="167.0" />
|
||||
<point x="-31.77777777777783" y="58.5" />
|
||||
</edge>
|
||||
</edges>
|
||||
<settings layout="Hierarchic Group" zoom="0.30000000000000016" x="1124.0" y="1313.0" />
|
||||
<SelectedNodes>
|
||||
<node>de.joethei.monopoly.colors.UnderlinedColor</node>
|
||||
</SelectedNodes>
|
||||
<Categories>
|
||||
<Category>Fields</Category>
|
||||
<Category>Inner Classes</Category>
|
||||
<Category>Constructors</Category>
|
||||
<Category>Properties</Category>
|
||||
<Category>Methods</Category>
|
||||
</Categories>
|
||||
<SCOPE>All</SCOPE>
|
||||
<VISIBILITY>private</VISIBILITY>
|
||||
</Diagram>
|
||||
|
43
pom.xml
Normal file
43
pom.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>de.joethei</groupId>
|
||||
<artifactId>Monopoly</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>de.joethei.monopoly.Monopoly</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.20</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
16
src/main/java/de/joethei/monopoly/Action.java
Normal file
16
src/main/java/de/joethei/monopoly/Action.java
Normal file
@ -0,0 +1,16 @@
|
||||
package de.joethei.monopoly;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter @AllArgsConstructor
|
||||
public abstract class Action {
|
||||
|
||||
private String name;
|
||||
public abstract void execute(Player player);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
14
src/main/java/de/joethei/monopoly/CircularLinkedList.java
Normal file
14
src/main/java/de/joethei/monopoly/CircularLinkedList.java
Normal file
@ -0,0 +1,14 @@
|
||||
package de.joethei.monopoly;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class CircularLinkedList<E> extends LinkedList<E> {
|
||||
|
||||
@Override
|
||||
public E get(int index) {
|
||||
while (index >= size()) {
|
||||
index = index - size();
|
||||
}
|
||||
return super.get(index);
|
||||
}
|
||||
}
|
86
src/main/java/de/joethei/monopoly/Main.java
Normal file
86
src/main/java/de/joethei/monopoly/Main.java
Normal file
@ -0,0 +1,86 @@
|
||||
package de.joethei.monopoly;
|
||||
|
||||
import de.joethei.monopoly.colors.BoldColor;
|
||||
import de.joethei.monopoly.colors.ConsoleColor;
|
||||
import de.joethei.monopoly.colors.NormalColor;
|
||||
import de.joethei.monopoly.fields.Field;
|
||||
import de.joethei.monopoly.fields.Street;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
@Getter private static List<Player> players = new LinkedList<>();
|
||||
@Getter private static CircularLinkedList<Field> fields = new CircularLinkedList<>();
|
||||
|
||||
public static void main(String[] args) {
|
||||
Random random = new Random();
|
||||
|
||||
fields.add(new Street("Hausweg", BoldColor.RED));
|
||||
fields.add(new Street("Torstraße", BoldColor.RED));
|
||||
fields.add(new Street("Baumstraße", BoldColor.BLUE));
|
||||
fields.add(new Street("Hotelstraße", BoldColor.BLUE));
|
||||
fields.add(new Street("Straßenweg", BoldColor.GREEN));
|
||||
fields.add(new Street("Hauptstraße", BoldColor.GREEN));
|
||||
fields.add(new Street("Mauerstraße", BoldColor.CYAN));
|
||||
fields.add(new Street("TesterStraße", BoldColor.CYAN));
|
||||
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
System.out.println("Spieleranzahl eingeben");
|
||||
int playerNumber = scanner.nextInt();
|
||||
|
||||
for (int i = 0; i < playerNumber; i++) {
|
||||
System.out.println("Name des " + (players.size() + 1) + ". Spielers eingeben");
|
||||
players.add(new Player(scanner.next(), NormalColor.values()[i]));
|
||||
}
|
||||
|
||||
boolean running = true;
|
||||
while(running) {
|
||||
if(players.size() <= 0) {
|
||||
Player player = players.get(0);
|
||||
System.out.println(player.getColor().getColorCode() + player.getName() + " hat gewonnen");
|
||||
running = false;
|
||||
}
|
||||
for(Player player : players) {
|
||||
if(player.getMoney() <= 0) {
|
||||
System.out.println(player.getColor().getColorCode() + player.getName() + " ist ausgeschieden");
|
||||
players.remove(player);
|
||||
}
|
||||
Field field = fields.get(player.getField() + (random.nextInt(10) + 2));
|
||||
|
||||
if(field instanceof Street) {
|
||||
Street street = (Street) field;
|
||||
if(street.getOwner() == null) {
|
||||
System.out.println(player.getColor().getColorCode() +
|
||||
"Möchtest du das Feld " + street.getColor().getColorCode() + field.getName() +
|
||||
player.getColor().getColorCode() + " kaufen ?");
|
||||
if(scanner.next().equalsIgnoreCase("ja")) {
|
||||
player.buy(street);
|
||||
}
|
||||
}else {
|
||||
if(street.getOwner() == player && street.getHouses() < 5) {
|
||||
System.out.println(player.getColor().getColorCode() + "Möchtest du auf dem Feld " + street.getColor().getColorCode() +
|
||||
street.getName() + player.getColor().getColorCode() + " ein Haus bauen ?");
|
||||
if(scanner.next().equalsIgnoreCase("ja")) field.getOptionalAction().execute(player);
|
||||
}
|
||||
field.getRequiredAction().execute(player);
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static long getFieldsByColor(ConsoleColor color) {
|
||||
return fields.stream().filter(field -> field instanceof Street && ((Street) field).getColor().equals(color)).count();
|
||||
}
|
||||
}
|
263
src/main/java/de/joethei/monopoly/Monopoly.java
Normal file
263
src/main/java/de/joethei/monopoly/Monopoly.java
Normal file
@ -0,0 +1,263 @@
|
||||
package de.joethei.monopoly;
|
||||
|
||||
import de.joethei.monopoly.action.Action;
|
||||
import de.joethei.monopoly.action.Card;
|
||||
import de.joethei.monopoly.colors.BrightColor;
|
||||
import de.joethei.monopoly.colors.ConsoleColor;
|
||||
import de.joethei.monopoly.colors.NormalColor;
|
||||
import de.joethei.monopoly.fields.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public class Monopoly {
|
||||
private static List<Player> players = new LinkedList<>();
|
||||
private static Map<Player, Integer> playersInJail = new LinkedHashMap<>();
|
||||
private static List<Field> fields = new CircularLinkedList<>();
|
||||
private static List<Card> cards = new LinkedList<>();
|
||||
private static Random random;
|
||||
private static ConcurrentMap<String, AtomicLong> statistics = new ConcurrentHashMap<>();
|
||||
|
||||
public static void main(String[] args) {
|
||||
random = new Random();
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
|
||||
//Anlegen des Spielfeldes
|
||||
fields.add(new Field("Start"));
|
||||
fields.add(new Street("Badstraße",40, NormalColor.PURPLE));
|
||||
fields.add(new Event());
|
||||
fields.add(new Street("Turmstraße", 80, NormalColor.PURPLE));
|
||||
fields.add(new Tax("Einkommensteuer", 20));
|
||||
fields.add(new TrainStation("Südbahnhof", 500));
|
||||
fields.add(new Street("Chauseestraße", 120, BrightColor.BLUE));
|
||||
fields.add(new Event());
|
||||
fields.add(new Street("Elisenstraße", 120, BrightColor.BLUE));
|
||||
fields.add(new Street("Poststraße", 160, BrightColor.BLUE));
|
||||
fields.add(new Jail());
|
||||
fields.add(new Street("Seestraße", 200, BrightColor.PURPLE));
|
||||
fields.add(new Factory("Elektrizitätswerk", 80));
|
||||
fields.add(new Street("Hafenstraße", 200, BrightColor.PURPLE));
|
||||
fields.add(new Street("Neue Straße", 240, BrightColor.PURPLE));
|
||||
fields.add(new TrainStation("Westbahnhof", 500));
|
||||
fields.add(new Street("Münchener Straße", 280, NormalColor.YELLOW));
|
||||
fields.add(new Event());
|
||||
fields.add(new Street("Wiener Straße", 280, NormalColor.YELLOW));
|
||||
fields.add(new Street("Berliner Straße",320, NormalColor.YELLOW));
|
||||
fields.add(new FreeParking());
|
||||
fields.add(new Street("Theaterstraße", 360, NormalColor.RED));
|
||||
fields.add(new Event());
|
||||
fields.add(new Street("Museumsstraße", 360, NormalColor.RED));
|
||||
fields.add(new Street("Opernplatz", 400, NormalColor.RED));
|
||||
fields.add(new TrainStation("Nordbahnhof", 500));
|
||||
fields.add(new Street("Lessingstraße", 440, BrightColor.YELLOW));
|
||||
fields.add(new Street("Schillerstraße", 440, BrightColor.YELLOW));
|
||||
fields.add(new Factory("Wasserwerk", 80));
|
||||
fields.add(new Street("Goethestraße", 480, BrightColor.YELLOW));
|
||||
fields.add(new Jail());
|
||||
fields.add(new Street("Rathausplatz", 520, NormalColor.GREEN));
|
||||
fields.add(new Street("Hauptstraße", 520, NormalColor.GREEN));
|
||||
fields.add(new Event());
|
||||
fields.add(new Street("Bahnhofsstraße", 560, NormalColor.GREEN));
|
||||
fields.add(new TrainStation("Hauptbahnhof", 500));
|
||||
fields.add(new Event());
|
||||
fields.add(new Street("Parkstraße", 700, NormalColor.BLUE));
|
||||
fields.add(new Tax("Zusatzsteuer", 300));
|
||||
fields.add(new Street("Schloßalle", 1000, NormalColor.BLUE));
|
||||
|
||||
//anlegen der Karten
|
||||
cards.add(new Card("Eins deiner Häuser braucht eine Renovierung", 500, false, false));
|
||||
cards.add(new Card("Wasserschaden, die Versicherung will nicht zahlen", 1000, false, false));
|
||||
cards.add(new Card("Du bist zu schnell gefahren", 50, false, false));
|
||||
cards.add(new Card("Eine deiner Straßen muss ausgebessert werden", 800, false, false));
|
||||
cards.add(new Card("Du bist betrunken Auto gefahren", 100, false, false));
|
||||
cards.add(new Card("Einer deiner Mieter hat einen Handwerker benötigt", 500, false, false));
|
||||
cards.add(new Card("Du wurdest zum Vorstand gewählt", 5, false, true));
|
||||
cards.add(new Card("3 Felder zurück", 0, false, false) {
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
System.out.println("Du wurdest 3 Felder nach hinten geworfen");
|
||||
player.setField(player.getField() - 3);
|
||||
}
|
||||
});
|
||||
|
||||
cards.add(new Card("Steuerrückzahlung", 1000, true, false));
|
||||
cards.add(new Card("Du hast im Lotto gewonnen", 2000, true, false));
|
||||
cards.add(new Card("Zinsen sind fällig", 30, true, false));
|
||||
cards.add(new Card("Dividende ist fällig", 1000, true, false));
|
||||
cards.add(new Card("Du hast von einem unbekannten Verwandten geerbt", 2000, true, false));
|
||||
cards.add(new Card("Du hast Geburtstag, jeder schenkt dir", 50, true, true));
|
||||
cards.add(new Card("Die Bank hat einen Fehler gemacht", 400, true, false));
|
||||
cards.add(new Card("Gefängnisfreikarte", 0, true, false) {
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
System.out.println("Du hast eine Gefängnisfreikarte erhalten");
|
||||
player.setJailFreeCards(player.getJailFreeCards() + 1);
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
statistics.put("rounds", new AtomicLong(0));
|
||||
statistics.put("buildHouses", new AtomicLong(0));
|
||||
statistics.put("jailRounds", new AtomicLong(0));
|
||||
statistics.put("jailFreeCards", new AtomicLong(0));
|
||||
statistics.put("movedFields", new AtomicLong(0));
|
||||
statistics.put("eventCards", new AtomicLong(0));
|
||||
statistics.put("tax", new AtomicLong(0));
|
||||
|
||||
System.out.println("Spieleranzahl eingeben");
|
||||
int playerNumber = scanner.nextInt();
|
||||
if(playerNumber <= 1) {
|
||||
System.out.println("Zu wenige Spieler");
|
||||
System.exit(1);
|
||||
}
|
||||
else if(playerNumber >= 6) {
|
||||
System.out.println("Zu viele Spieler");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < playerNumber; i++) {
|
||||
System.out.println("Name des " + (players.size() + 1) + ". Spielers eingeben");
|
||||
players.add(new Player(scanner.next(), NormalColor.values()[i]));
|
||||
System.out.println("Du hast die Farbe " + NormalColor.values()[i].getColorCode() + NormalColor.values()[i].name() + NormalColor.RESET.getColorCode());
|
||||
}
|
||||
System.out.println("Spiel wird gestartet.");
|
||||
statistics.put("time", new AtomicLong(System.currentTimeMillis()));
|
||||
|
||||
List<Player> toRemove = new LinkedList<>();
|
||||
|
||||
while(true) {
|
||||
statistics.get("rounds").incrementAndGet();
|
||||
for(Player player : players) {
|
||||
|
||||
if(player.getMoney() <= 0) {
|
||||
System.out.println(player.getColor().getColorCode() + player.getName() + " ist pleite");
|
||||
toRemove.add(player);
|
||||
}
|
||||
if(players.size() <= 1) {
|
||||
Player p = players.get(0);
|
||||
System.out.println(p.getColor().getColorCode() + p.getName() + " hat gewonnen" + NormalColor.RESET.getColorCode());
|
||||
System.out.println("========= Ein paar Statistiken ==========");
|
||||
System.out.println("Gespielte Runden: " + statistics.get("rounds"));
|
||||
System.out.println("Davon im Gefängnis verbracht: " + statistics.get("jailRounds"));
|
||||
long time = System.currentTimeMillis() - statistics.get("time").longValue();
|
||||
System.out.println("Spieldauer: " + String.format("%d Minuten, %d Sekunden", TimeUnit.MILLISECONDS.toMinutes(time), TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(time))));
|
||||
System.out.println("Zurückgelegte Schritte: " + statistics.get("movedFields"));
|
||||
System.out.println("Gebaute Häuser:" + statistics.get("buildHouses"));
|
||||
System.out.println("Bezahlte Steuern: " + statistics.get("tax") + "€");
|
||||
System.out.println("Verwendete Ereigniskarten: " + statistics.get("eventCards"));
|
||||
System.out.println("Davon vewendete Gefängnisfreikarten: " + statistics.get("jailFreeCards"));
|
||||
System.out.println("=========================================");
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
else if(playersInJail.containsKey(player)) {
|
||||
System.out.println(player.getColor().getColorCode() + "======================" + NormalColor.RESET.getColorCode());
|
||||
if(playersInJail.get(player) == 1) {
|
||||
System.out.println("Du wurdest frei gelassen");
|
||||
playersInJail.remove(player);
|
||||
}
|
||||
else if(player.getJailFreeCards() > 0) {
|
||||
player.setJailFreeCards(player.getJailFreeCards() - 1);
|
||||
playersInJail.remove(player);
|
||||
System.out.println("Du hast eine Gefängnisfreikarte verwendet um wieder mitspielen zu dürfen");
|
||||
statistics.get("jailFreeCards").incrementAndGet();
|
||||
}else {
|
||||
playersInJail.replace(player, playersInJail.get(player) - 1);
|
||||
Monopoly.getStatistics().get("jailRounds").incrementAndGet();
|
||||
System.out.println("Du musst noch " + playersInJail.get(player) + " Runden warten um wieder mitspielen zu dürfen");
|
||||
}
|
||||
System.out.println(player.getColor().getColorCode() + "======================" + NormalColor.RESET.getColorCode());
|
||||
|
||||
}else if(!toRemove.contains(player)){
|
||||
int r = random.nextInt(10) + 2;
|
||||
int id = player.getField() + r;
|
||||
statistics.get("movedFields").addAndGet(r);
|
||||
|
||||
//Start überschritten oder genau getroffen
|
||||
if((id + player.getField()) >= fields.size()) {
|
||||
player.setMoney(player.getMoney() + 200);
|
||||
}
|
||||
|
||||
Field field = fields.get(id);
|
||||
player.setField(id);
|
||||
|
||||
System.out.println(player.getColor().getColorCode() + "======================" + NormalColor.RESET.getColorCode());
|
||||
System.out.println("Kontostand: " + player.getMoney() + "€");
|
||||
System.out.println("Gewürfelt: " + r);
|
||||
System.out.println("Feld: " + field.getName());
|
||||
if(field instanceof OwnableField) {
|
||||
OwnableField ownableField = (OwnableField) field;
|
||||
if(ownableField.getOwner() != null) System.out.println("Besitzer: " + ownableField.getOwner().getColor().getColorCode() + ownableField.getOwner().getName() + NormalColor.RESET.getColorCode());
|
||||
else System.out.println("Preis: " + ((OwnableField) field).getPrice() + "€");
|
||||
}
|
||||
field.getActions().forEach(action -> {
|
||||
if(action.canExecute(player) && action.isRequired()) action.execute(player);
|
||||
});
|
||||
|
||||
if(field.getActions().size() > 0) {
|
||||
|
||||
System.out.println("Mögliche Aktionen:");
|
||||
for (Action action : field.getActions()) {
|
||||
if(action.canExecute(player) && !action.isRequired()) {
|
||||
System.out.println(field.getActions().indexOf(action) + ": " + action.getName());
|
||||
}
|
||||
}
|
||||
System.out.println("n: nächster Spieler");
|
||||
|
||||
|
||||
String input = scanner.next();
|
||||
if(!input.equalsIgnoreCase("n")) {
|
||||
field.getActions().get(Integer.parseInt(input)).execute(player);
|
||||
}
|
||||
}
|
||||
System.out.println(player.getColor().getColorCode() + "======================" + NormalColor.RESET.getColorCode());
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
//ein bisschen warten nach jedem Durchlauf
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for(Player player : toRemove) {
|
||||
players.remove(player);
|
||||
}
|
||||
toRemove.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static long getFieldsByColor(ConsoleColor color) {
|
||||
return fields.stream().filter(field -> field instanceof Street && ((Street) field).getColor().equals(color)).count();
|
||||
}
|
||||
|
||||
public static List<Player> getPlayers() {
|
||||
return Monopoly.players;
|
||||
}
|
||||
|
||||
public static Map<Player, Integer> getPlayersInJail() {
|
||||
return Monopoly.playersInJail;
|
||||
}
|
||||
|
||||
public static List<Field> getFields() {
|
||||
return Monopoly.fields;
|
||||
}
|
||||
|
||||
public static List<Card> getCards() {
|
||||
return Monopoly.cards;
|
||||
}
|
||||
|
||||
public static ConcurrentMap<String, AtomicLong> getStatistics() {
|
||||
return Monopoly.statistics;
|
||||
}
|
||||
|
||||
public static Random getRandom() {
|
||||
return Monopoly.random;
|
||||
}
|
||||
}
|
63
src/main/java/de/joethei/monopoly/Player.java
Normal file
63
src/main/java/de/joethei/monopoly/Player.java
Normal file
@ -0,0 +1,63 @@
|
||||
package de.joethei.monopoly;
|
||||
|
||||
import de.joethei.monopoly.colors.ConsoleColor;
|
||||
import de.joethei.monopoly.colors.NormalColor;
|
||||
import de.joethei.monopoly.fields.OwnableField;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class Player {
|
||||
private List<OwnableField> owning = new LinkedList<>();
|
||||
private String name;
|
||||
private int field;
|
||||
private int jailFreeCards = 0;
|
||||
private long money = 1000;
|
||||
private ConsoleColor color;
|
||||
|
||||
Player(String name, ConsoleColor color) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return color.getColorCode() + name + ": " + " | " + money + NormalColor.RESET.getColorCode();
|
||||
}
|
||||
|
||||
public List<OwnableField> getOwning() {
|
||||
return this.owning;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getField() {
|
||||
return this.field;
|
||||
}
|
||||
|
||||
public int getJailFreeCards() {
|
||||
return this.jailFreeCards;
|
||||
}
|
||||
|
||||
public long getMoney() {
|
||||
return this.money;
|
||||
}
|
||||
|
||||
public ConsoleColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public void setField(int field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public void setJailFreeCards(int jailFreeCards) {
|
||||
this.jailFreeCards = jailFreeCards;
|
||||
}
|
||||
|
||||
public void setMoney(long money) {
|
||||
this.money = money;
|
||||
}
|
||||
}
|
53
src/main/java/de/joethei/monopoly/action/Action.java
Normal file
53
src/main/java/de/joethei/monopoly/action/Action.java
Normal file
@ -0,0 +1,53 @@
|
||||
package de.joethei.monopoly.action;
|
||||
|
||||
import de.joethei.monopoly.Monopoly;
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.fields.Field;
|
||||
import de.joethei.monopoly.fields.OwnableField;
|
||||
|
||||
public abstract class Action {
|
||||
|
||||
private String name;
|
||||
private Field field;
|
||||
private ActionType actionType;
|
||||
|
||||
public Action(String name, Field field, ActionType actionType) {
|
||||
this.name = name;
|
||||
this.field = field;
|
||||
this.actionType = actionType;
|
||||
}
|
||||
|
||||
public abstract void execute(Player player);
|
||||
|
||||
public boolean isRequired() {
|
||||
return actionType == ActionType.REQUIRED || actionType == ActionType.REQUIRED_OWNER;
|
||||
}
|
||||
|
||||
|
||||
public boolean canExecute(Player player) {
|
||||
if(Monopoly.getFields().get(player.getField()).equals(field)) {
|
||||
|
||||
if(field instanceof OwnableField) {
|
||||
OwnableField ownableField = (OwnableField) field;
|
||||
if(actionType == ActionType.OPTIONAL && ownableField.getOwner() == null) return true;
|
||||
if(actionType == ActionType.OPTIONAL_OWNER && ownableField.getOwner() == player) return true;
|
||||
if(actionType == ActionType.REQUIRED && ownableField.getOwner() != player) return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Field getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public ActionType getActionType() {
|
||||
return actionType;
|
||||
}
|
||||
}
|
9
src/main/java/de/joethei/monopoly/action/ActionType.java
Normal file
9
src/main/java/de/joethei/monopoly/action/ActionType.java
Normal file
@ -0,0 +1,9 @@
|
||||
package de.joethei.monopoly.action;
|
||||
|
||||
public enum ActionType {
|
||||
|
||||
REQUIRED,
|
||||
OPTIONAL,
|
||||
REQUIRED_OWNER,
|
||||
OPTIONAL_OWNER
|
||||
}
|
54
src/main/java/de/joethei/monopoly/action/Card.java
Normal file
54
src/main/java/de/joethei/monopoly/action/Card.java
Normal file
@ -0,0 +1,54 @@
|
||||
package de.joethei.monopoly.action;
|
||||
|
||||
import de.joethei.monopoly.Monopoly;
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.colors.BrightColor;
|
||||
import de.joethei.monopoly.colors.NormalColor;
|
||||
|
||||
public class Card {
|
||||
|
||||
private String name;
|
||||
private int money;
|
||||
private boolean positive;
|
||||
private boolean otherPlayers;
|
||||
|
||||
public Card(String name, int money, boolean positive, boolean otherPlayers) {
|
||||
this.name = name;
|
||||
this.money = money;
|
||||
this.positive = positive;
|
||||
this.otherPlayers = otherPlayers;
|
||||
}
|
||||
|
||||
public void execute(Player player) {
|
||||
if(otherPlayers) {
|
||||
if(positive) {
|
||||
System.out.println(name + " " + BrightColor.GREEN.getColorCode() + "+" + (money * (Monopoly.getPlayers().size() -1)) + "€" + NormalColor.RESET.getColorCode());
|
||||
for(Player players : Monopoly.getPlayers()) {
|
||||
if(players != player) {
|
||||
player.setMoney(player.getMoney() + money);
|
||||
players.setMoney(players.getMoney() - money);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
System.out.println(name + " " + NormalColor.RED.getColorCode() + "-" + (money * (Monopoly.getPlayers().size() -1)) + "€" + NormalColor.RESET.getColorCode());
|
||||
for(Player players : Monopoly.getPlayers()) {
|
||||
if(players != player) {
|
||||
player.setMoney(player.getMoney() - money);
|
||||
players.setMoney(players.getMoney() + money);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
if(positive) {
|
||||
System.out.println(name + " " + BrightColor.GREEN.getColorCode() + "+" + money + "€" + NormalColor.RESET.getColorCode());
|
||||
player.setMoney(player.getMoney() + money);
|
||||
}
|
||||
else {
|
||||
System.out.println(name + " " + NormalColor.RED.getColorCode() + "-" + money + "€" + NormalColor.RESET.getColorCode());
|
||||
player.setMoney(player.getMoney() - money);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package de.joethei.monopoly.actions;
|
||||
|
||||
import de.joethei.monopoly.Monopoly;
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.action.Action;
|
||||
import de.joethei.monopoly.action.ActionType;
|
||||
import de.joethei.monopoly.fields.Field;
|
||||
import de.joethei.monopoly.fields.OwnableField;
|
||||
import de.joethei.monopoly.fields.Street;
|
||||
|
||||
public class BuildHouseAction extends Action {
|
||||
|
||||
public BuildHouseAction(Field field) {
|
||||
super("ein Haus bauen", field, ActionType.OPTIONAL_OWNER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
if (player.getMoney() <= 100) {
|
||||
System.out.println(player.getColor().getColorCode() + "Du hast nicht genug Geld");
|
||||
}else {
|
||||
Street street = (Street) getField();
|
||||
int i = 0;
|
||||
for(OwnableField field : street.getOwner().getOwning()) {
|
||||
if(field instanceof Street) {
|
||||
Street s = (Street) field;
|
||||
if(s.getColor().equals(street.getColor())) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i >= Monopoly.getFieldsByColor(street.getColor())) {
|
||||
if (street.getHouses() <= 4) {
|
||||
street.setHouses(street.getHouses() + 1);
|
||||
System.out.println("Haus gebaut");
|
||||
player.setMoney(player.getMoney() - 100);
|
||||
Monopoly.getStatistics().get("buildHouses").incrementAndGet();
|
||||
} else if (street.getHouses() == 5) {
|
||||
System.out.println("Du hast bereits ein Hotel in dieser Straße");
|
||||
}
|
||||
}else {
|
||||
System.out.println("Du besitzt nicht alle Straßen dieser Farbe");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package de.joethei.monopoly.actions;
|
||||
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.action.Action;
|
||||
import de.joethei.monopoly.action.ActionType;
|
||||
import de.joethei.monopoly.fields.Field;
|
||||
import de.joethei.monopoly.fields.OwnableField;
|
||||
|
||||
public class BuyFieldAction extends Action{
|
||||
|
||||
public BuyFieldAction(Field field) {
|
||||
super("das Feld kaufen", field, ActionType.OPTIONAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
OwnableField field = (OwnableField) getField();
|
||||
if(field.getOwner() == null) {
|
||||
if(player.getMoney() >= field.getPrice()) {
|
||||
player.setMoney(player.getMoney() - field.getPrice());
|
||||
player.getOwning().add(field);
|
||||
field.setOwner(player);
|
||||
System.out.println(player.getColor().getColorCode() + "Gekauft!");
|
||||
}else System.out.println(player.getColor().getColorCode() + "Du hast nicht genug Geld");
|
||||
}
|
||||
}
|
||||
}
|
32
src/main/java/de/joethei/monopoly/actions/PayRentAction.java
Normal file
32
src/main/java/de/joethei/monopoly/actions/PayRentAction.java
Normal file
@ -0,0 +1,32 @@
|
||||
package de.joethei.monopoly.actions;
|
||||
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.action.Action;
|
||||
import de.joethei.monopoly.action.ActionType;
|
||||
import de.joethei.monopoly.fields.Field;
|
||||
import de.joethei.monopoly.fields.OwnableField;
|
||||
import de.joethei.monopoly.fields.Street;
|
||||
|
||||
public class PayRentAction extends Action{
|
||||
|
||||
private int rent;
|
||||
|
||||
public PayRentAction(Field field, int rent) {
|
||||
super("Miete bezahlt", field, ActionType.REQUIRED);
|
||||
this.rent = rent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
OwnableField field = (OwnableField) getField();
|
||||
if(field.getOwner() != null) {
|
||||
int money = rent;
|
||||
if(field instanceof Street) {
|
||||
Street street = (Street) field;
|
||||
money = rent * street.getHouses();
|
||||
}
|
||||
field.getOwner().setMoney(field.getOwner().getMoney() + money);
|
||||
player.setMoney(player.getMoney() - money);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package de.joethei.monopoly.actions;
|
||||
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.action.Action;
|
||||
import de.joethei.monopoly.action.ActionType;
|
||||
import de.joethei.monopoly.fields.Field;
|
||||
import de.joethei.monopoly.fields.OwnableField;
|
||||
import de.joethei.monopoly.fields.Street;
|
||||
|
||||
public class SellFieldAction extends Action{
|
||||
|
||||
public SellFieldAction(Field field) {
|
||||
super("das Feld verkaufen", field, ActionType.OPTIONAL_OWNER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
OwnableField field = (OwnableField) getField();
|
||||
if(field.getOwner() == player) {
|
||||
int price;
|
||||
if(field instanceof Street) {
|
||||
Street street = (Street) field;
|
||||
price = field.getPrice() + (street.getHouses() * 100);
|
||||
}else price = field.getPrice();
|
||||
player.setMoney(player.getMoney() + price);
|
||||
player.getOwning().remove(field);
|
||||
field.setOwner(null);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package de.joethei.monopoly.colors;
|
||||
|
||||
public enum BackgroundBrightColor implements ConsoleColor{
|
||||
|
||||
BLACK("\033[0;100m"),
|
||||
RED("\033[0;101m"),
|
||||
GREEN("\033[0;102m"),
|
||||
YELLOW("\033[0;103m"),
|
||||
BLUE("\033[0;104m"),
|
||||
PURPLE("\033[0;105m"),
|
||||
CYAN("\033[0;106m"),
|
||||
WHITE("\033[0;107m");
|
||||
|
||||
private String colorCode;
|
||||
|
||||
BackgroundBrightColor(String colorCode) {
|
||||
this.colorCode = colorCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorCode() {
|
||||
return colorCode;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package de.joethei.monopoly.colors;
|
||||
|
||||
public enum BackgroundColor implements ConsoleColor{
|
||||
|
||||
BLACK_BACKGROUND("\033[40m"),
|
||||
RED_BACKGROUND("\033[41m"),
|
||||
GREEN_BACKGROUND("\033[42m"),
|
||||
YELLOW_BACKGROUND("\033[43m"),
|
||||
BLUE_BACKGROUND("\033[44m"),
|
||||
PURPLE_BACKGROUND("\033[45m"),
|
||||
CYAN_BACKGROUND("\033[46m"),
|
||||
WHITE_BACKGROUND("\033[47m");
|
||||
|
||||
private String colorCode;
|
||||
|
||||
BackgroundColor(String colorCode) {
|
||||
this.colorCode = colorCode;
|
||||
}
|
||||
|
||||
public String getColorCode() {
|
||||
return this.colorCode;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package de.joethei.monopoly.colors;
|
||||
|
||||
public enum BoldBrightColor {
|
||||
|
||||
BLACK("\033[1;90m"),
|
||||
RED("\033[1;91m"),
|
||||
GREEN("\033[1;92m"),
|
||||
YELLOW("\033[1;93m"),
|
||||
BLUE("\033[1;94m"),
|
||||
PURPLE("\033[1;95m"),
|
||||
CYAN("\033[1;96m"),
|
||||
WHITE("\033[1;97m");
|
||||
|
||||
private String colorCode;
|
||||
|
||||
BoldBrightColor(String colorCode) {
|
||||
this.colorCode = colorCode;
|
||||
}
|
||||
|
||||
public String getColorCode() {
|
||||
return this.colorCode;
|
||||
}
|
||||
}
|
23
src/main/java/de/joethei/monopoly/colors/BoldColor.java
Normal file
23
src/main/java/de/joethei/monopoly/colors/BoldColor.java
Normal file
@ -0,0 +1,23 @@
|
||||
package de.joethei.monopoly.colors;
|
||||
|
||||
public enum BoldColor implements ConsoleColor{
|
||||
|
||||
BLACK("\033[1;30m"),
|
||||
RED("\033[1;31m"),
|
||||
GREEN("\033[1;32m"),
|
||||
YELLOW("\033[1;33m"),
|
||||
BLUE("\033[1;34m"),
|
||||
PURPLE("\033[1;35m"),
|
||||
CYAN("\033[1;36m"),
|
||||
WHITE("\033[1;37m");
|
||||
|
||||
private String colorCode;
|
||||
|
||||
BoldColor(String colorCode) {
|
||||
this.colorCode = colorCode;
|
||||
}
|
||||
|
||||
public String getColorCode() {
|
||||
return this.colorCode;
|
||||
}
|
||||
}
|
24
src/main/java/de/joethei/monopoly/colors/BrightColor.java
Normal file
24
src/main/java/de/joethei/monopoly/colors/BrightColor.java
Normal file
@ -0,0 +1,24 @@
|
||||
package de.joethei.monopoly.colors;
|
||||
|
||||
public enum BrightColor implements ConsoleColor{
|
||||
|
||||
BLACK("\033[0;90m"),
|
||||
RED("\033[0;91m"),
|
||||
GREEN("\033[0;92m"),
|
||||
YELLOW("\033[0;93m"),
|
||||
BLUE("\033[0;94m"),
|
||||
PURPLE("\033[0;95m"),
|
||||
CYAN("\033[0;96m"),
|
||||
WHITE("\033[0;97m");
|
||||
|
||||
private String colorCode;
|
||||
|
||||
BrightColor(String colorCode) {
|
||||
this.colorCode = colorCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorCode() {
|
||||
return colorCode;
|
||||
}
|
||||
}
|
11
src/main/java/de/joethei/monopoly/colors/ConsoleColor.java
Normal file
11
src/main/java/de/joethei/monopoly/colors/ConsoleColor.java
Normal file
@ -0,0 +1,11 @@
|
||||
package de.joethei.monopoly.colors;
|
||||
|
||||
|
||||
/**
|
||||
* Sorgt für Farbausgaben in der Konsole
|
||||
* Funktioniert nur in Konsolen die ANSI unterstützen(also nicht unter Windows)
|
||||
*/
|
||||
public interface ConsoleColor {
|
||||
|
||||
public String getColorCode();
|
||||
}
|
23
src/main/java/de/joethei/monopoly/colors/NormalColor.java
Normal file
23
src/main/java/de/joethei/monopoly/colors/NormalColor.java
Normal file
@ -0,0 +1,23 @@
|
||||
package de.joethei.monopoly.colors;
|
||||
|
||||
public enum NormalColor implements ConsoleColor{
|
||||
|
||||
RED("\033[0;31m"),
|
||||
GREEN("\033[0;32m"),
|
||||
YELLOW("\033[0;33m"),
|
||||
BLUE("\033[0;34m"),
|
||||
PURPLE("\033[0;35m"),
|
||||
CYAN("\033[0;36m"),
|
||||
WHITE("\033[0;37m"),
|
||||
RESET("\033[0m");
|
||||
|
||||
private String colorCode;
|
||||
|
||||
NormalColor(String colorCode) {
|
||||
this.colorCode = colorCode;
|
||||
}
|
||||
|
||||
public String getColorCode() {
|
||||
return this.colorCode;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package de.joethei.monopoly.colors;
|
||||
|
||||
public enum UnderlinedColor implements ConsoleColor{
|
||||
|
||||
BLACK("\033[4;30m"),
|
||||
RED("\033[4;31m"),
|
||||
GREEN("\033[4;32m"),
|
||||
YELLOW("\033[4;33m"),
|
||||
BLUE("\033[4;34m"),
|
||||
PURPLE("\033[4;35m"),
|
||||
CYAN("\033[4;36m");
|
||||
|
||||
private String colorCode;
|
||||
|
||||
UnderlinedColor(String colorCode) {
|
||||
this.colorCode = colorCode;
|
||||
}
|
||||
|
||||
public String getColorCode() {
|
||||
return this.colorCode;
|
||||
}
|
||||
}
|
21
src/main/java/de/joethei/monopoly/fields/Event.java
Normal file
21
src/main/java/de/joethei/monopoly/fields/Event.java
Normal file
@ -0,0 +1,21 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
import de.joethei.monopoly.Monopoly;
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.action.Action;
|
||||
import de.joethei.monopoly.action.ActionType;
|
||||
|
||||
public class Event extends Field{
|
||||
|
||||
public Event() {
|
||||
super("Ereignisfeld");
|
||||
getActions().add(new Action("Karte erhalten und ausführen", this, ActionType.REQUIRED) {
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
Monopoly.getStatistics().get("eventCards").incrementAndGet();
|
||||
int random = Monopoly.getRandom().nextInt(Monopoly.getCards().size());
|
||||
Monopoly.getCards().get(random).execute(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
15
src/main/java/de/joethei/monopoly/fields/Factory.java
Normal file
15
src/main/java/de/joethei/monopoly/fields/Factory.java
Normal file
@ -0,0 +1,15 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
import de.joethei.monopoly.actions.BuyFieldAction;
|
||||
import de.joethei.monopoly.actions.PayRentAction;
|
||||
import de.joethei.monopoly.actions.SellFieldAction;
|
||||
|
||||
public class Factory extends OwnableField{
|
||||
|
||||
public Factory(String name, int price) {
|
||||
super(name, price);
|
||||
getActions().add(new BuyFieldAction(this));
|
||||
getActions().add(new SellFieldAction(this));
|
||||
getActions().add(new PayRentAction(this, 100));
|
||||
}
|
||||
}
|
23
src/main/java/de/joethei/monopoly/fields/Field.java
Normal file
23
src/main/java/de/joethei/monopoly/fields/Field.java
Normal file
@ -0,0 +1,23 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
import de.joethei.monopoly.action.Action;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Field {
|
||||
|
||||
private ArrayList<Action> actions = new ArrayList<>();
|
||||
private String name;
|
||||
|
||||
public Field(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ArrayList<Action> getActions() {
|
||||
return this.actions;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
public class FreeParking extends Field{
|
||||
public FreeParking() {
|
||||
super("Frei parken");
|
||||
}
|
||||
}
|
19
src/main/java/de/joethei/monopoly/fields/Jail.java
Normal file
19
src/main/java/de/joethei/monopoly/fields/Jail.java
Normal file
@ -0,0 +1,19 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
import de.joethei.monopoly.Monopoly;
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.action.Action;
|
||||
import de.joethei.monopoly.action.ActionType;
|
||||
|
||||
public class Jail extends Field {
|
||||
|
||||
public Jail() {
|
||||
super("Gefängnis");
|
||||
getActions().add(new Action("eingebuchtet", this, ActionType.REQUIRED) {
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
Monopoly.getPlayersInJail().put(player, 3);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
27
src/main/java/de/joethei/monopoly/fields/OwnableField.java
Normal file
27
src/main/java/de/joethei/monopoly/fields/OwnableField.java
Normal file
@ -0,0 +1,27 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
import de.joethei.monopoly.Player;
|
||||
|
||||
public class OwnableField extends Field {
|
||||
|
||||
private Player owner;
|
||||
private int price;
|
||||
|
||||
OwnableField(String name, int price) {
|
||||
super(name);
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Player getOwner() {
|
||||
return this.owner;
|
||||
}
|
||||
|
||||
public int getPrice() {
|
||||
return this.price;
|
||||
}
|
||||
|
||||
public void setOwner(Player owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
}
|
40
src/main/java/de/joethei/monopoly/fields/Street.java
Normal file
40
src/main/java/de/joethei/monopoly/fields/Street.java
Normal file
@ -0,0 +1,40 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
import de.joethei.monopoly.actions.BuildHouseAction;
|
||||
import de.joethei.monopoly.actions.BuyFieldAction;
|
||||
import de.joethei.monopoly.actions.PayRentAction;
|
||||
import de.joethei.monopoly.actions.SellFieldAction;
|
||||
import de.joethei.monopoly.colors.ConsoleColor;
|
||||
import de.joethei.monopoly.colors.NormalColor;
|
||||
public class Street extends OwnableField {
|
||||
|
||||
private ConsoleColor color;
|
||||
private int houses = 0;
|
||||
|
||||
public Street(String name, int price, ConsoleColor color) {
|
||||
super(name, price);
|
||||
this.color = color;
|
||||
|
||||
getActions().add(new BuyFieldAction(this));
|
||||
getActions().add(new SellFieldAction(this));
|
||||
getActions().add(new BuildHouseAction(this));
|
||||
getActions().add(new PayRentAction(this, 50));
|
||||
}
|
||||
|
||||
public ConsoleColor getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public int getHouses() {
|
||||
return houses;
|
||||
}
|
||||
|
||||
public void setHouses(int houses) {
|
||||
this.houses = houses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return color.getColorCode() + super.getName() + NormalColor.RESET.getColorCode();
|
||||
}
|
||||
}
|
20
src/main/java/de/joethei/monopoly/fields/Tax.java
Normal file
20
src/main/java/de/joethei/monopoly/fields/Tax.java
Normal file
@ -0,0 +1,20 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
import de.joethei.monopoly.Monopoly;
|
||||
import de.joethei.monopoly.Player;
|
||||
import de.joethei.monopoly.action.Action;
|
||||
import de.joethei.monopoly.action.ActionType;
|
||||
|
||||
public class Tax extends Field{
|
||||
|
||||
public Tax(String name, int tax) {
|
||||
super(name);
|
||||
getActions().add(new Action("Steuer zahlen", this, ActionType.REQUIRED) {
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
Monopoly.getStatistics().get("tax").addAndGet(tax);
|
||||
player.setMoney(player.getMoney() - tax);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
15
src/main/java/de/joethei/monopoly/fields/TrainStation.java
Normal file
15
src/main/java/de/joethei/monopoly/fields/TrainStation.java
Normal file
@ -0,0 +1,15 @@
|
||||
package de.joethei.monopoly.fields;
|
||||
|
||||
import de.joethei.monopoly.actions.BuyFieldAction;
|
||||
import de.joethei.monopoly.actions.PayRentAction;
|
||||
import de.joethei.monopoly.actions.SellFieldAction;
|
||||
|
||||
public class TrainStation extends OwnableField{
|
||||
|
||||
public TrainStation(String name, int price) {
|
||||
super(name, price);
|
||||
getActions().add(new BuyFieldAction(this));
|
||||
getActions().add(new SellFieldAction(this));
|
||||
getActions().add(new PayRentAction(this, 25));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user