Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
821d27098c | ||
|
|
a8d1b1011f | ||
|
|
dc963742aa | ||
|
|
76baf0f2cf | ||
|
|
879655f62e | ||
|
|
6f39911a34 | ||
|
|
71f1f272f2 | ||
|
|
a0a8626436 | ||
|
|
3af890f4b5 | ||
|
|
c1a4456328 | ||
|
|
a29997e733 | ||
|
|
da218c1134 | ||
|
|
2e71767311 | ||
|
|
940b160a4e | ||
|
|
6567c1cbbe | ||
|
|
1c5d53afc1 | ||
|
|
380e5fbca0 | ||
|
|
5f1ffd2520 | ||
|
|
cd1e244201 | ||
|
|
bd81d42a3b | ||
|
|
0afe5c8c69 | ||
|
|
dc3f2f53ca | ||
|
|
498d455277 | ||
|
|
ddc2b8df73 | ||
|
|
ef6c2d3dd0 | ||
|
|
7a4421e722 | ||
|
|
85c71fdf0b | ||
|
|
8eeeb10b5d | ||
|
|
2de96ca23d | ||
|
|
7f41ccf7b5 | ||
|
|
43ee0c1562 | ||
|
|
3b060c446c | ||
|
|
9795b47ce4 | ||
|
|
d880c5c616 | ||
|
|
01cef05115 |
@@ -0,0 +1 @@
|
|||||||
|
/Java-Knight/target/
|
||||||
@@ -0,0 +1,387 @@
|
|||||||
|
<mxfile host="app.diagrams.net">
|
||||||
|
<diagram name="Page-1" id="S8xx0SNJsf2MUWKB9l3i">
|
||||||
|
<mxGraphModel dx="2732" dy="1763" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" background="light-dark(#ffffff, #000000)" math="0" shadow="0">
|
||||||
|
<root>
|
||||||
|
<mxCell id="0" />
|
||||||
|
<mxCell id="1" parent="0" />
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-25" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="Item<div>"abstract"</div>" vertex="1">
|
||||||
|
<mxGeometry height="126" width="160" x="-130" y="518.75" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-26" parent="Kkar4GxZ3Pt5WynWM7sy-25" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="- Name : string" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="40" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-205" parent="Kkar4GxZ3Pt5WynWM7sy-25" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="+ Owner : Entity" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="66" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-27" parent="Kkar4GxZ3Pt5WynWM7sy-25" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="160" y="92" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-28" parent="Kkar4GxZ3Pt5WynWM7sy-25" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="+ GetName() : String" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="100" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-29" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="SellableItem" vertex="1">
|
||||||
|
<mxGeometry height="90" width="160" x="-280" y="720" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-30" parent="Kkar4GxZ3Pt5WynWM7sy-29" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="- Price : int" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-31" parent="Kkar4GxZ3Pt5WynWM7sy-29" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="160" y="56" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-32" parent="Kkar4GxZ3Pt5WynWM7sy-29" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="+ GetPrice() : int" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="64" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-34" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=56;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="KeyItem" vertex="1">
|
||||||
|
<mxGeometry height="30" width="160" x="20" y="720" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-38" parent="1" style="verticalAlign=top;align=left;overflow=fill;html=1;whiteSpace=wrap;" value="<p style="margin:0px;margin-top:4px;text-align:center;"><b>IAttachable</b></p><p style="margin:0px;margin-top:4px;text-align:center;"><i>"Interface"</i><br></p><hr size="1" style="border-style:solid;"><p style="margin:0px;margin-left:4px;">+ AttachTo(entity: Entity): Void</p><p style="margin:0px;margin-left:4px;">+ DeAttachFrom(entity: Entity): void</p>" vertex="1">
|
||||||
|
<mxGeometry height="85" width="220" x="-660" y="650" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-46" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;dashed=1;dashPattern=8 8;" target="Kkar4GxZ3Pt5WynWM7sy-43">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-39" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="Accessory<div>"abstract"</div>" vertex="1">
|
||||||
|
<mxGeometry height="100" width="160" x="-480" y="880" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-40" parent="Kkar4GxZ3Pt5WynWM7sy-39" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="- Health : int" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="40" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-41" parent="Kkar4GxZ3Pt5WynWM7sy-39" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="160" y="66" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-42" parent="Kkar4GxZ3Pt5WynWM7sy-39" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="+ GetHealth() : int" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="74" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-43" parent="1" style="verticalAlign=top;align=left;overflow=fill;html=1;whiteSpace=wrap;spacingTop=0;spacingBottom=0;" value="<div style="line-height: 160%;"><p style="margin:0px;margin-top:4px;text-align:center;"><b>IDamageable</b></p><p style="margin:0px;margin-top:4px;text-align:center;"><i>"Interface"</i><br></p><hr size="1" style="border-style:solid;"><p style="margin:0px;margin-left:4px;">+ TakeDamage(int amount) : void</p><p style="margin:0px;margin-left:4px;">+ HandleZeroHealth() : void</p><p style="margin:0px;margin-left:4px;">+ IsDestroyed() : boolean</p></div>" vertex="1">
|
||||||
|
<mxGeometry height="120" width="320" x="-490" y="480" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-45" parent="1" style="verticalAlign=top;align=left;overflow=fill;html=1;whiteSpace=wrap;spacingTop=0;spacingBottom=0;" value="<div style="line-height: 160%;"><p style="margin: 4px 0px 0px; text-align: center;"><b>IDamager</b></p><p style="margin: 4px 0px 0px; text-align: center;"><i>"Interface"</i><br></p><hr size="1" style="border-style: solid;"><p style="margin: 0px 0px 0px 4px;">+ Damage(target: IDamageable) : void&nbsp;</p><p style="margin: 0px 0px 0px 4px;">+ GetUtils() : IDamager[]</p><p style="margin: 0px 0px 0px 4px;">+ GetDamage() : int</p></div>" vertex="1">
|
||||||
|
<mxGeometry height="115" width="330" x="-1220" y="515" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-49" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.496;entryY=0.974;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;entryPerimeter=0;" target="Kkar4GxZ3Pt5WynWM7sy-28">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="-95" y="800" as="sourcePoint" />
|
||||||
|
<mxPoint x="-5" y="620" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-50" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;entryX=0.493;entryY=1.001;entryDx=0;entryDy=0;entryPerimeter=0;" target="Kkar4GxZ3Pt5WynWM7sy-28">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="-10" y="841" as="sourcePoint" />
|
||||||
|
<mxPoint x="-50" y="650" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-52" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0.492;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;entryPerimeter=0;" target="Kkar4GxZ3Pt5WynWM7sy-32">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="-250" y="941" as="sourcePoint" />
|
||||||
|
<mxPoint x="-101" y="870" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-53" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="Weapon" vertex="1">
|
||||||
|
<mxGeometry height="56" width="160" x="-670" y="1030" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-54" parent="Kkar4GxZ3Pt5WynWM7sy-53" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="<div>- Damage : int</div>" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-61" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="Shield" vertex="1">
|
||||||
|
<mxGeometry height="56" width="160" x="-270" y="1030" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-62" parent="Kkar4GxZ3Pt5WynWM7sy-61" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="<div>- Defense : int</div>" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-65" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="Costum" vertex="1">
|
||||||
|
<mxGeometry height="56" width="160" x="-480" y="1030" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-66" parent="Kkar4GxZ3Pt5WynWM7sy-65" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" value="<div>- Defense : int</div>" vertex="1">
|
||||||
|
<mxGeometry height="26" width="160" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-69" parent="1" style="verticalAlign=top;align=left;overflow=fill;html=1;whiteSpace=wrap;spacingTop=0;spacingBottom=0;" value="<div style="line-height: 160%;"><p style="margin:0px;margin-top:4px;text-align:center;"><b>IDefender</b></p><p style="margin:0px;margin-top:4px;text-align:center;"><i>"Interface"</i><br></p><hr size="1" style="border-style:solid;"><p style="margin:0px;margin-left:4px;">+ Apply(int damage) : int</p><p style="margin:0px;margin-left:4px;">+ GetDefense() : int</p></div>" vertex="1">
|
||||||
|
<mxGeometry height="100" width="190" x="-80" y="900" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-70" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-65" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;dashed=1;dashPattern=8 8;" target="Kkar4GxZ3Pt5WynWM7sy-69">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="-300" y="1053" />
|
||||||
|
<mxPoint x="-300" y="1020" />
|
||||||
|
<mxPoint x="15" y="1020" />
|
||||||
|
</Array>
|
||||||
|
<mxPoint x="-240" y="1250" as="sourcePoint" />
|
||||||
|
<mxPoint x="-155" y="990" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-71" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;dashed=1;dashPattern=8 8;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-69">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="15" y="1053" />
|
||||||
|
</Array>
|
||||||
|
<mxPoint x="150" y="920" as="sourcePoint" />
|
||||||
|
<mxPoint x="20" y="1000" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-72" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-53" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.477;entryY=1.035;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;entryPerimeter=0;" target="Kkar4GxZ3Pt5WynWM7sy-42">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="-530" y="933" as="sourcePoint" />
|
||||||
|
<mxPoint x="-411" y="840" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-73" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.48;entryY=1.035;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;entryPerimeter=0;" target="Kkar4GxZ3Pt5WynWM7sy-42">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="-260" y="973" as="sourcePoint" />
|
||||||
|
<mxPoint x="-141" y="880" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-74" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-65" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.477;entryY=1.035;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;entryPerimeter=0;" target="Kkar4GxZ3Pt5WynWM7sy-42">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="-280" y="970" as="sourcePoint" />
|
||||||
|
<mxPoint x="-161" y="877" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-76" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-105" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;endSize=18;startSize=18;startArrow=diamondThin;startFill=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-205">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="150" y="290" as="sourcePoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-85" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-96" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;dashed=1;dashPattern=8 8;exitX=0;exitY=0;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-43">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="260" y="130" as="sourcePoint" />
|
||||||
|
<mxPoint x="-210" y="220" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-86" parent="1" style="verticalAlign=top;align=left;overflow=fill;html=1;whiteSpace=wrap;spacingTop=0;spacingBottom=0;" value="<div style="line-height: 160%;"><p style="margin:0px;margin-top:4px;text-align:center;"><b>IHealable</b></p><p style="margin:0px;margin-top:4px;text-align:center;"><i>"Interface"</i><br></p><hr size="1" style="border-style:solid;"><p style="margin:0px;margin-left:4px;">+ Heal(int amount) : void</p></div>" vertex="1">
|
||||||
|
<mxGeometry height="82.5" width="320" x="-840" y="518.75" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-87" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-96" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;dashed=1;dashPattern=8 8;exitX=0;exitY=0;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-86">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="240" y="170" as="sourcePoint" />
|
||||||
|
<mxPoint x="-320" y="510" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-96" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Entity</span><div style="font-weight: 400;">"abstract"</div>" vertex="1">
|
||||||
|
<mxGeometry height="528" width="280" x="220" y="340" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-100" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ MaxHealth : int" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="40" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-208" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ Health : int" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="70" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-109" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ Costum : Custom" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="100" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-108" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ Weapon : Weapon" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="130" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-107" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ Shield : Sheild" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="160" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-106" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ Money : long" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="190" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-105" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ Inverntory : ArrayList&lt;Item&gt;" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="220" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-104" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ State : EntityState" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="250" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-103" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ BaseDamage : int" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="280" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-98" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="280" y="310" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-112" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ ModifyMoney(amount: long, dir: boolean) : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="318" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-113" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ GetInventory() : Item[]" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="348" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-118" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ GetInventoryByClass(class: ItemClass) : Item[]" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="378" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-115" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ sellItem(item: Item) : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="408" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-116" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ SellUnnecesarry() : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="438" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-117" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ SellSellable() : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="468" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-119" parent="Kkar4GxZ3Pt5WynWM7sy-96" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ AddToInventory(item: Item) : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="280" y="498" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-120" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Player</span><br><div style="font-weight: 400;">"abstract"</div>" vertex="1">
|
||||||
|
<mxGeometry height="408" width="270" x="-165" y="-120" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-129" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ MaxStamina : int" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="40" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-130" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ Stamina : int" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="70" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-141" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="<div>+ Level : int</div>" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="100" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-142" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="<div>+ CurLevelProcess: int</div>" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="130" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-131" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="160" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-132" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ AddLevelProcess(int amount) : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="168" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-133" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ UpgradeLevel() : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="198" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-145" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ lightAttack() : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="228" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-146" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ heavyAttack() : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="258" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-147" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ defend() : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="288" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-148" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ heal() : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="318" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-114" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ ModifyStamina(amount: int, dir: boolean) : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="348" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-149" parent="Kkar4GxZ3Pt5WynWM7sy-120" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ abstract specialAbility() : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="378" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-143" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-120" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.996;exitY=0.039;exitDx=0;exitDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-96">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="490" y="120" as="sourcePoint" />
|
||||||
|
<mxPoint x="340" y="50" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-144" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-120" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;dashed=1;dashPattern=8 8;exitX=0.025;exitY=0.054;exitDx=0;exitDy=0;exitPerimeter=0;" target="Kkar4GxZ3Pt5WynWM7sy-45">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="-370" y="40" as="sourcePoint" />
|
||||||
|
<mxPoint x="-530" y="349" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-152" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Enemy</span><br><div style="font-weight: 400;">"abstract"</div>" vertex="1">
|
||||||
|
<mxGeometry height="138" width="270" x="505" y="-100" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-167" parent="Kkar4GxZ3Pt5WynWM7sy-152" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ Key: KeyItem" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="40" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-157" parent="Kkar4GxZ3Pt5WynWM7sy-152" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="70" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-158" parent="Kkar4GxZ3Pt5WynWM7sy-152" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ DropLoot(player: Player) : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="78" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-184" parent="Kkar4GxZ3Pt5WynWM7sy-152" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;container=0;" value="+ abstract AttackPlayer(player: Player) : void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="270" y="108" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-165" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-152" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0.25;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-96">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="510" y="-150" as="sourcePoint" />
|
||||||
|
<mxPoint x="466" y="585" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-168" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Dragon</span>" vertex="1">
|
||||||
|
<mxGeometry height="38" width="270" x="295" y="-310" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-170" parent="Kkar4GxZ3Pt5WynWM7sy-168" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-180" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Goblin</span>" vertex="1">
|
||||||
|
<mxGeometry height="38" width="270" x="695" y="-310" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-182" parent="Kkar4GxZ3Pt5WynWM7sy-180" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-185" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Skeleton</span>" vertex="1">
|
||||||
|
<mxGeometry height="38" width="270" x="295" y="-220" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-186" parent="Kkar4GxZ3Pt5WynWM7sy-185" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-187" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Vampire</span>" vertex="1">
|
||||||
|
<mxGeometry height="38" width="270" x="695" y="-220" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-188" parent="Kkar4GxZ3Pt5WynWM7sy-187" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-190" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-185" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-152">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="1140" y="-20" as="sourcePoint" />
|
||||||
|
<mxPoint x="995" y="495" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-193" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-168" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-152">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="1005" y="-10" as="sourcePoint" />
|
||||||
|
<mxPoint x="1080" y="91" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-194" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-187" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-152">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="975" y="20" as="sourcePoint" />
|
||||||
|
<mxPoint x="1050" y="211" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-195" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-180" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-152">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="1010" y="-10" as="sourcePoint" />
|
||||||
|
<mxPoint x="955" y="91" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-196" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Wisard</span>" vertex="1">
|
||||||
|
<mxGeometry height="38" width="270" x="-330" y="-220" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-197" parent="Kkar4GxZ3Pt5WynWM7sy-196" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-198" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Assasin</span>" vertex="1">
|
||||||
|
<mxGeometry height="38" width="270" x="-165" y="-340" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-199" parent="Kkar4GxZ3Pt5WynWM7sy-198" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-200" parent="1" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="<span style="font-weight: 400;">Knight</span>" vertex="1">
|
||||||
|
<mxGeometry height="38" width="270" x="5" y="-220" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-201" parent="Kkar4GxZ3Pt5WynWM7sy-200" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" value="" vertex="1">
|
||||||
|
<mxGeometry height="8" width="270" y="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-202" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-200" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-120">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="290" y="-410" as="sourcePoint" />
|
||||||
|
<mxPoint x="235" y="-219" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-203" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-196" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-120">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="200" y="-360" as="sourcePoint" />
|
||||||
|
<mxPoint x="165" y="-249" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-204" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-198" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=0;startSize=16;endSize=15;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-120">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="165" y="-410" as="sourcePoint" />
|
||||||
|
<mxPoint x="195" y="-299" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-206" edge="1" parent="1" source="Kkar4GxZ3Pt5WynWM7sy-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;startSize=16;endSize=15;dashed=1;dashPattern=8 8;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" target="Kkar4GxZ3Pt5WynWM7sy-38">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="-400" y="820" />
|
||||||
|
<mxPoint x="-550" y="820" />
|
||||||
|
</Array>
|
||||||
|
<mxPoint x="-390" y="1190" as="sourcePoint" />
|
||||||
|
<mxPoint x="-169" y="1380" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Kkar4GxZ3Pt5WynWM7sy-207" parent="1" style="verticalAlign=top;align=left;overflow=fill;html=1;whiteSpace=wrap;spacingTop=0;spacingBottom=0;" value="<div style="line-height: 160%;"><p style="margin:0px;margin-top:4px;text-align:center;"><b>IDefendable</b></p><p style="margin:0px;margin-top:4px;text-align:center;"><i>"Interface"</i><br></p><hr size="1" style="border-style:solid;"><p style="margin:0px;margin-left:4px;"><span style="background-color: transparent; color: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));">+ GetDefenders() : IDefender[]</span></p></div>" vertex="1">
|
||||||
|
<mxGeometry height="90" width="320" x="-1000" y="180" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
</root>
|
||||||
|
</mxGraphModel>
|
||||||
|
</diagram>
|
||||||
|
</mxfile>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 212 KiB |
@@ -0,0 +1,8 @@
|
|||||||
|
package org.project.Interface;
|
||||||
|
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
public interface IAttachable {
|
||||||
|
public void AttachTo(Entity entity, boolean fromInventory);
|
||||||
|
public void DeattachFrom(Entity entity, boolean toInventory);
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package org.project.Interface;
|
||||||
|
|
||||||
|
public interface IDamageUtil {
|
||||||
|
public int GetDamage();
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.project.Interface;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
|
||||||
|
public interface IDamageable {
|
||||||
|
public void TakeDamage(int amount, AttackPowerUp[] powerUps);
|
||||||
|
public boolean IsDestroyed();
|
||||||
|
public void HandleZeroHealth();
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.project.Interface;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
|
||||||
|
public interface IDamager {
|
||||||
|
public void Damage(IDamageable target, int amount, AttackPowerUp[] powerUps);
|
||||||
|
public IDamageUtil[] GetDamageUtils();
|
||||||
|
public int GetDamage();
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package org.project.Interface;
|
||||||
|
|
||||||
|
public interface IDefendable {
|
||||||
|
public IDefender[] GetDefenders();
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.project.Interface;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
|
||||||
|
public interface IDefender {
|
||||||
|
public int Apply(int damage, AttackPowerUp[] powerUps);
|
||||||
|
public int GetDefense();
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package org.project.Interface;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.FightMoves;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public interface IFighter {
|
||||||
|
public void LightAttack(IDamageable target);
|
||||||
|
public void HeavyAttack(IDamageable target);
|
||||||
|
public void defend();
|
||||||
|
public void HealMove();
|
||||||
|
public void SpecialAbility(Entity entity);
|
||||||
|
public ArrayList<FightMoves> GetAvailableMoves();
|
||||||
|
|
||||||
|
public String GetSpecialAbilityDescription(Entity entity);
|
||||||
|
|
||||||
|
public String GetSpecialAbilityResultDescription(Entity entity);
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package org.project.Interface;
|
||||||
|
|
||||||
|
public interface IHealable {
|
||||||
|
public void Heal(int amount);
|
||||||
|
}
|
||||||
@@ -1,15 +1,49 @@
|
|||||||
package org.project;
|
package org.project;
|
||||||
|
|
||||||
import org.project.location.Location;
|
import org.project.constants.appConstants.GameModes;
|
||||||
|
import org.project.constants.appConstants.TextColor;
|
||||||
|
import org.project.engine.MainEngine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Scanner;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
static void main(String[] args) {
|
||||||
// TODO: ADD LOCATIONS TO YOUR GAME
|
Scanner scanner = new Scanner(System.in);
|
||||||
List<Location> locations = new ArrayList<>();
|
boolean endGame = false;
|
||||||
|
|
||||||
// TODO: IMPLEMENT GAMEPLAY
|
while (true) {
|
||||||
|
|
||||||
|
System.out.println(TextColor.Cyan + "JAVA KNIGHT" + TextColor.Reset);
|
||||||
|
System.out.println(
|
||||||
|
"""
|
||||||
|
0 > Single Player
|
||||||
|
1 > Local Multiplayer
|
||||||
|
2 > Exit
|
||||||
|
"""
|
||||||
|
);
|
||||||
|
|
||||||
|
GameModes gameMode = null;
|
||||||
|
while (true){
|
||||||
|
int choice = scanner.nextInt();
|
||||||
|
|
||||||
|
if (choice == 0) {
|
||||||
|
gameMode = GameModes.SINGLE_PLAYER;
|
||||||
|
break;
|
||||||
|
} else if (choice == 1) {
|
||||||
|
gameMode = GameModes.MULTI_PLAYER_LOCAL;
|
||||||
|
break;
|
||||||
|
} else if (choice == 2) {
|
||||||
|
endGame = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endGame) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
MainEngine engine = MainEngine.CreateEngine(gameMode);
|
||||||
|
engine.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package org.project.common.models;
|
||||||
|
|
||||||
|
public record EntityDiff(int health, int stamina, boolean lostShield, boolean lostCostume, int shieldHealth, int costumeHealth) {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package org.project.constants.appConstants;
|
||||||
|
|
||||||
|
public class ConsoleColor {
|
||||||
|
public static final String Reset = "\u001B[0m";
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package org.project.constants.appConstants;
|
||||||
|
|
||||||
|
public enum GameModes {
|
||||||
|
SINGLE_PLAYER,
|
||||||
|
MULTI_PLAYER_LOCAL
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.project.constants.appConstants;
|
||||||
|
|
||||||
|
public class TextColor extends ConsoleColor{
|
||||||
|
public static String Black = "\u001B[30m";
|
||||||
|
public static String Red = "\u001B[31m";
|
||||||
|
public static String Green = "\u001B[32m";
|
||||||
|
public static String Yellow = "\u001B[33m";
|
||||||
|
public static String Blue = "\u001B[34m";
|
||||||
|
public static String Magenta = "\u001B[35m";
|
||||||
|
public static String Cyan = "\u001B[36m";
|
||||||
|
public static String White = "\u001B[37m";
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
public enum AttackPowerUp {
|
||||||
|
ANTI_SHIELD,
|
||||||
|
ANTI_CUSTOM,
|
||||||
|
NO_DEFENSE,
|
||||||
|
INEVITABLE,
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
|
||||||
|
public final class Costumes {
|
||||||
|
public static Costume cheapCostume = new Costume("cheap costume", null, 40, 100, 100, 10);
|
||||||
|
public static Costume SteelCostume = new Costume("steel costume", null, 150, 300, 300, 30);
|
||||||
|
public static Costume GoldenCostume = new Costume("golden costume", null, 500, 500, 500, 100);
|
||||||
|
public static Costume MasterCostume = new Costume("master costume", null, 1500, 1000, 1000, 300);
|
||||||
|
|
||||||
|
public static Costume[] getCostumes() {
|
||||||
|
return new Costume[]{cheapCostume, SteelCostume, GoldenCostume, MasterCostume};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
public enum DefencePowerUp {
|
||||||
|
INVISIBLE,
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
public enum EntityState {
|
||||||
|
ALIVE,
|
||||||
|
DOWNED,
|
||||||
|
DEAD,
|
||||||
|
FROZEN
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
public enum FightMoves {
|
||||||
|
LIGHT_ATTACK,
|
||||||
|
HEAVY_ATTACK,
|
||||||
|
HEAL,
|
||||||
|
DEFEND,
|
||||||
|
SPECIAL
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
public enum ItemClass {
|
||||||
|
KEY,
|
||||||
|
SELLABLE,
|
||||||
|
UNNECESSARY,
|
||||||
|
ACCESSORY,
|
||||||
|
SHIELD,
|
||||||
|
WEAPON,
|
||||||
|
COSTUME,
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
import org.project.item.Accessory.Accessory;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.KeyItem;
|
||||||
|
import org.project.item.SellableItem;
|
||||||
|
|
||||||
|
public final class ItemClassExt {
|
||||||
|
private ItemClassExt() {}
|
||||||
|
|
||||||
|
public static boolean Matches(ItemClass itemClass, Object subject) {
|
||||||
|
return switch (itemClass) {
|
||||||
|
case KEY -> subject instanceof KeyItem;
|
||||||
|
case SELLABLE -> subject instanceof SellableItem;
|
||||||
|
case UNNECESSARY -> subject.getClass() == SellableItem.class;
|
||||||
|
case ACCESSORY -> subject instanceof Accessory;
|
||||||
|
case WEAPON -> subject instanceof Weapon;
|
||||||
|
case COSTUME -> subject instanceof Costume;
|
||||||
|
case SHIELD -> subject instanceof Shield;
|
||||||
|
case null, default -> false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
public enum PlayerRoles {
|
||||||
|
KNIGHT,
|
||||||
|
WIZARD,
|
||||||
|
ASSASSIN
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
import org.project.entity.players.Assassin;
|
||||||
|
import org.project.entity.players.Knight;
|
||||||
|
import org.project.entity.players.Player;
|
||||||
|
import org.project.entity.players.Wizard;
|
||||||
|
|
||||||
|
public final class PlayerRolesExt {
|
||||||
|
private PlayerRolesExt() {}
|
||||||
|
|
||||||
|
public static Player CreatePlayer(PlayerRoles role, String name, int level) {
|
||||||
|
return switch (role) {
|
||||||
|
case KNIGHT -> new Knight(name, level);
|
||||||
|
case ASSASSIN -> new Assassin(name, level);
|
||||||
|
case WIZARD -> new Wizard(name, level);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Player CreatePlayer(PlayerRoles role, String name) {
|
||||||
|
return switch (role) {
|
||||||
|
case KNIGHT -> new Knight(name);
|
||||||
|
case ASSASSIN -> new Assassin(name);
|
||||||
|
case WIZARD -> new Wizard(name);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
|
||||||
|
public final class Shields {
|
||||||
|
public static Shield WoodenShield = new Shield("wooden shield", null, 40, 100, 100, 10);
|
||||||
|
public static Shield SteelShield = new Shield("steel shield", null, 150, 300, 300, 30);
|
||||||
|
public static Shield GoldenShield = new Shield("golden shield", null, 500, 500, 500, 100);
|
||||||
|
public static Shield MasterShield = new Shield("master shield", null, 1500, 1000, 1000, 300);
|
||||||
|
|
||||||
|
public static Shield[] getShields() {
|
||||||
|
return new Shield[]{WoodenShield, SteelShield, GoldenShield, MasterShield};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.project.constants.gameConstant;
|
||||||
|
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
|
||||||
|
public final class Weapons {
|
||||||
|
public static Weapon Dagger = new Weapon("dagger", null, 40, 100, 100, 10);
|
||||||
|
public static Weapon SteelSword = new Weapon("steel sword", null, 150, 100, 100, 30);
|
||||||
|
public static Weapon GoldenSword = new Weapon("golden sword", null, 500, 100, 100, 100);
|
||||||
|
public static Weapon MasterSword = new Weapon("master sword", null, 1500, 100, 100, 300);
|
||||||
|
|
||||||
|
public static Weapon[] getWeapons() {
|
||||||
|
return new Weapon[] {Dagger, SteelSword, GoldenSword, MasterSword};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package org.project.engine;
|
||||||
|
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
public abstract class BattleEngine {
|
||||||
|
public Entity Player1;
|
||||||
|
public Entity Player2;
|
||||||
|
|
||||||
|
public BattleEngine(Entity player1, Entity player2) {
|
||||||
|
player1.ResetStamina();
|
||||||
|
player1.RestoreHealth();
|
||||||
|
player2.RestoreHealth();
|
||||||
|
player2.ResetStamina();
|
||||||
|
Player1 = player1;
|
||||||
|
Player2 = player2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void StartBattle();
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package org.project.engine;
|
||||||
|
|
||||||
|
import org.project.constants.appConstants.GameModes;
|
||||||
|
import org.project.constants.gameConstant.PlayerRoles;
|
||||||
|
import org.project.constants.gameConstant.PlayerRolesExt;
|
||||||
|
import org.project.entity.players.Player;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public abstract class MainEngine {
|
||||||
|
protected MainEngine() {}
|
||||||
|
|
||||||
|
public abstract void run();
|
||||||
|
|
||||||
|
public static MainEngine CreateEngine(GameModes mode) {
|
||||||
|
return switch (mode) {
|
||||||
|
case GameModes.SINGLE_PLAYER -> new SinglePlayerEngine();
|
||||||
|
case GameModes.MULTI_PLAYER_LOCAL -> new MultiplayerEngine();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Player RoleMenu(String name, int level) {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
PlayerRoles[] roles = PlayerRoles.values();
|
||||||
|
int index = 0;
|
||||||
|
while (true) {
|
||||||
|
for (PlayerRoles role : roles) {
|
||||||
|
System.out.println(index + " > " + role.name().toLowerCase());
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
int choice = scanner.nextInt();
|
||||||
|
|
||||||
|
if (choice >= 0 && choice < roles.length) {
|
||||||
|
return PlayerRolesExt.CreatePlayer(roles[choice], name, level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Player RoleMenu(String name) {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
PlayerRoles[] roles = PlayerRoles.values();
|
||||||
|
int index = 0;
|
||||||
|
while (true) {
|
||||||
|
for (PlayerRoles role : roles) {
|
||||||
|
System.out.println(index + " > " + role.name().toLowerCase());
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
int choice = scanner.nextInt();
|
||||||
|
|
||||||
|
if (choice >= 0 && choice < roles.length) {
|
||||||
|
return PlayerRolesExt.CreatePlayer(roles[choice], name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
package org.project.engine;
|
||||||
|
|
||||||
|
import org.project.common.models.EntityDiff;
|
||||||
|
import org.project.constants.appConstants.TextColor;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
|
import org.project.constants.gameConstant.FightMoves;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.entity.players.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Dictionary;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class MultiPlayerBattleEngine extends BattleEngine {
|
||||||
|
private final Player player1;
|
||||||
|
private final Player player2;
|
||||||
|
private Player player1Past;
|
||||||
|
private Player player2Past;
|
||||||
|
|
||||||
|
public MultiPlayerBattleEngine(Player player1, Player player2) {
|
||||||
|
super(player1, player2);
|
||||||
|
this.player1 = (Player) Player1;
|
||||||
|
this.player2 = (Player) Player2;
|
||||||
|
player1Past = player1.copy();
|
||||||
|
player2Past = player2.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void StartBattle() {
|
||||||
|
EntityDiff playerDiff;
|
||||||
|
EntityDiff enemyDiff;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
if (player1.GetState() != EntityState.FROZEN) {
|
||||||
|
FightMoves player1Move = PlayerMovesMenu(player1, player2);
|
||||||
|
showMoveExplanation(player1Move, player1, player2Past);
|
||||||
|
|
||||||
|
playerDiff = getPlayerDiff(player1Past, player1);
|
||||||
|
enemyDiff = getPlayerDiff(player2Past, player2);
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
showFighter(playerDiff, player1);
|
||||||
|
showFighter(enemyDiff, player2);
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player1.GetState() == EntityState.DEAD) {
|
||||||
|
System.out.println(TextColor.Green + player2.Name + " WON!" + TextColor.Reset);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player1Past.GetState() == EntityState.FROZEN) {
|
||||||
|
player1.SetState(EntityState.ALIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
player1Past = player1.copy();
|
||||||
|
player2Past = player2.copy();
|
||||||
|
|
||||||
|
|
||||||
|
if (player2.GetState() != EntityState.FROZEN)
|
||||||
|
{
|
||||||
|
FightMoves player2Move = PlayerMovesMenu(player2, player1);
|
||||||
|
showMoveExplanation(player2Move, player2, player1Past);
|
||||||
|
|
||||||
|
playerDiff = getPlayerDiff(player1Past, player1);
|
||||||
|
enemyDiff = getPlayerDiff(player2Past, player2);
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
showFighter(playerDiff, player1);
|
||||||
|
showFighter(enemyDiff, player2);
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player2.GetState() == EntityState.DEAD) {
|
||||||
|
System.out.println(TextColor.Green + player1.Name + " WON!" + TextColor.Reset);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player2Past.GetState() == EntityState.FROZEN) {
|
||||||
|
player2.SetState(EntityState.ALIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
player1Past = player1.copy();
|
||||||
|
player2Past = player2.copy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private EntityDiff getPlayerDiff(Entity oldVersion, Entity newVersion) {
|
||||||
|
return new EntityDiff(
|
||||||
|
newVersion.Health - oldVersion.Health,
|
||||||
|
newVersion.GetStamina() - oldVersion.GetStamina(),
|
||||||
|
(newVersion.Shield == null && oldVersion.Shield != null),
|
||||||
|
(newVersion.Weapon == null && oldVersion.Weapon != null),
|
||||||
|
(newVersion.Shield != null ? newVersion.Shield.GetHealth() : 0) - (oldVersion.Shield != null ? oldVersion.Shield.GetHealth() : 0),
|
||||||
|
(newVersion.Costume != null ? newVersion.Costume.GetHealth() : 0) - (oldVersion.Costume != null ? oldVersion.Costume.GetHealth() : 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showFighter(EntityDiff diff, Entity entity) {
|
||||||
|
System.out.println(entity.Name + ":");
|
||||||
|
|
||||||
|
String color = diff.health() > 0 ? TextColor.Green : TextColor.Red;
|
||||||
|
String sign = diff.health() > 0 ? "+" : "-";
|
||||||
|
System.out.println(" Health: " + entity.Health + " " + color + sign + Math.abs(diff.health()) + TextColor.Reset);
|
||||||
|
|
||||||
|
color = diff.stamina() > 0 ? TextColor.Green : TextColor.Red;
|
||||||
|
sign = diff.stamina() > 0 ? "+" : "-";
|
||||||
|
System.out.println(" Stamina: " + entity.GetStamina() + " " + color + sign + Math.abs(diff.stamina()) + TextColor.Reset);
|
||||||
|
|
||||||
|
if (diff.lostShield()) {
|
||||||
|
System.out.println(" Shield: " + entity.Shield.getName() + " " + TextColor.Red + "LOST" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (diff.lostCostume()) {
|
||||||
|
System.out.println(" Costume: " + entity.Costume.getName() + " " + TextColor.Red + "LOST" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.Shield != null) {
|
||||||
|
color = diff.shieldHealth() > 0 ? TextColor.Green : TextColor.Red;
|
||||||
|
sign = diff.shieldHealth() > 0 ? "+" : "-";
|
||||||
|
System.out.println(" Shield: " + entity.Shield.getName() + " " + color + sign + Math.abs(diff.shieldHealth()) + TextColor.Reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.Costume != null) {
|
||||||
|
color = diff.costumeHealth() > 0 ? TextColor.Green : TextColor.Red;
|
||||||
|
sign = diff.costumeHealth() > 0 ? "+" : "-";
|
||||||
|
System.out.println(" Costume: " + entity.Costume.getName() + " " + color + sign + Math.abs(diff.shieldHealth()) + TextColor.Reset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private FightMoves PlayerMovesMenu(Player performer, Player receiver) {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println(performer.Name + " it's your turn");
|
||||||
|
ArrayList<FightMoves> moves = performer.GetAvailableMoves();
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
Dictionary<Integer, FightMoves> dictionary = new Hashtable<>();
|
||||||
|
|
||||||
|
for (FightMoves move : moves) {
|
||||||
|
String result = index + " > " + move.toString();
|
||||||
|
|
||||||
|
if (move == FightMoves.SPECIAL) {
|
||||||
|
result += " (" + performer.GetSpecialAbilityDescription(receiver) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
dictionary.put(index, move);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean continueLoop;
|
||||||
|
while (true){
|
||||||
|
continueLoop = false;
|
||||||
|
int choice = scanner.nextInt();
|
||||||
|
FightMoves move = moves.get(choice);
|
||||||
|
|
||||||
|
switch (move) {
|
||||||
|
case FightMoves.LIGHT_ATTACK -> performer.LightAttack(receiver);
|
||||||
|
case FightMoves.HEAVY_ATTACK -> performer.HeavyAttack(receiver);
|
||||||
|
case FightMoves.SPECIAL -> performer.SpecialAbility(receiver);
|
||||||
|
case FightMoves.HEAL -> performer.HealMove();
|
||||||
|
case FightMoves.DEFEND -> performer.defend();
|
||||||
|
default -> continueLoop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!continueLoop) {
|
||||||
|
return move;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showMoveExplanation(FightMoves move, Entity performer, Entity receiver) {
|
||||||
|
System.out.print(TextColor.Cyan);
|
||||||
|
switch (move) {
|
||||||
|
case FightMoves.LIGHT_ATTACK -> System.out.println(performer.Name + " performs a light attack");
|
||||||
|
case FightMoves.HEAVY_ATTACK -> System.out.println(performer.Name + " performs a heavy attack");
|
||||||
|
case FightMoves.SPECIAL -> System.out.println(performer.GetSpecialAbilityResultDescription(receiver));
|
||||||
|
case FightMoves.HEAL -> System.out.println(performer.Name + " heals");
|
||||||
|
case FightMoves.DEFEND -> System.out.println(performer.Name + " get their guard up!");
|
||||||
|
}
|
||||||
|
System.out.print(TextColor.Reset);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package org.project.engine;
|
||||||
|
|
||||||
|
import org.project.constants.appConstants.TextColor;
|
||||||
|
import org.project.entity.players.Player;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class MultiplayerEngine extends MainEngine {
|
||||||
|
public MultiplayerEngine() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("Player 1, Set your name:");
|
||||||
|
String player1Name = scanner.nextLine();
|
||||||
|
|
||||||
|
System.out.println("Player 2, Set your name:");
|
||||||
|
String player2Name = scanner.nextLine();
|
||||||
|
|
||||||
|
System.out.println(player1Name + ", Set the level of your character:");
|
||||||
|
int player1Level = scanner.nextInt();
|
||||||
|
|
||||||
|
System.out.println(player2Name + ", Set the level of your character:");
|
||||||
|
int player2Level = scanner.nextInt();
|
||||||
|
|
||||||
|
System.out.println(player1Name + ", Set the role of your character:");
|
||||||
|
Player player1 = RoleMenu(player1Name, player1Level);
|
||||||
|
|
||||||
|
System.out.println(player2Name + ", Set the role of your character:");
|
||||||
|
Player player2 = RoleMenu(player2Name, player2Level);
|
||||||
|
|
||||||
|
System.out.println(TextColor.Red + "Now the battle begins" + TextColor.Reset);
|
||||||
|
BattleEngine engine = new MultiPlayerBattleEngine(player1, player2);
|
||||||
|
engine.StartBattle();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,185 @@
|
|||||||
|
package org.project.engine;
|
||||||
|
|
||||||
|
import org.project.common.models.EntityDiff;
|
||||||
|
import org.project.constants.appConstants.TextColor;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
|
import org.project.constants.gameConstant.FightMoves;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.entity.enemies.Enemy;
|
||||||
|
import org.project.entity.players.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Dictionary;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class SinglePlayerBattleEngine extends BattleEngine {
|
||||||
|
private final Player player;
|
||||||
|
private final Enemy enemy;
|
||||||
|
private Player playerPast;
|
||||||
|
private Enemy enemyPast;
|
||||||
|
public SinglePlayerBattleEngine(Player player, Enemy enemy) {
|
||||||
|
super(player, enemy);
|
||||||
|
this.player = (Player) Player1;
|
||||||
|
this.enemy = (Enemy) Player2;
|
||||||
|
playerPast = player.copy();
|
||||||
|
enemyPast = enemy.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void StartBattle() {
|
||||||
|
EntityDiff playerDiff;
|
||||||
|
EntityDiff enemyDiff;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
if (player.GetState() != EntityState.FROZEN) {
|
||||||
|
FightMoves playerMove = PlayerMovesMenu();
|
||||||
|
showMoveExplanation(playerMove, player, enemyPast);
|
||||||
|
|
||||||
|
playerDiff = getPlayerDiff(playerPast, player);
|
||||||
|
enemyDiff = getPlayerDiff(enemyPast, enemy);
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
showFighter(playerDiff, player);
|
||||||
|
showFighter(enemyDiff, enemy);
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerPast.GetState() == EntityState.FROZEN) {
|
||||||
|
player.SetState(EntityState.ALIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enemy.GetState() == EntityState.DEAD) {
|
||||||
|
enemy.DropLoot(player);
|
||||||
|
player.AddLevelProgress(enemy.LevelProgressAmount);
|
||||||
|
System.out.println(TextColor.Green + player.Name + " WON!" + TextColor.Reset);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerPast = player.copy();
|
||||||
|
enemyPast = enemy.copy();
|
||||||
|
|
||||||
|
if (enemy.GetState() != EntityState.FROZEN) {
|
||||||
|
FightMoves botMove = enemy.PlayRound(player);
|
||||||
|
showMoveExplanation(botMove, enemy, playerPast);
|
||||||
|
|
||||||
|
playerDiff = getPlayerDiff(playerPast, player);
|
||||||
|
enemyDiff = getPlayerDiff(enemyPast, enemy);
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
showFighter(playerDiff, player);
|
||||||
|
showFighter(enemyDiff, enemy);
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.GetState() == EntityState.DEAD) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enemyPast.GetState() == EntityState.FROZEN) {
|
||||||
|
enemy.SetState(EntityState.ALIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
playerPast = player.copy();
|
||||||
|
enemyPast = enemy.copy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private EntityDiff getPlayerDiff(Entity oldVersion, Entity newVersion) {
|
||||||
|
return new EntityDiff(
|
||||||
|
newVersion.Health - oldVersion.Health,
|
||||||
|
newVersion.GetStamina() - oldVersion.GetStamina(),
|
||||||
|
(newVersion.Shield == null && oldVersion.Shield != null),
|
||||||
|
(newVersion.Weapon == null && oldVersion.Weapon != null),
|
||||||
|
(newVersion.Shield != null ? newVersion.Shield.GetHealth() : 0) - (oldVersion.Shield != null ? oldVersion.Shield.GetHealth() : 0),
|
||||||
|
(newVersion.Costume != null ? newVersion.Costume.GetHealth() : 0) - (oldVersion.Costume != null ? oldVersion.Costume.GetHealth() : 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showFighter(EntityDiff diff, Entity entity) {
|
||||||
|
System.out.println(entity.Name + ":");
|
||||||
|
|
||||||
|
String color = diff.health() > 0 ? TextColor.Green : TextColor.Red;
|
||||||
|
String sign = diff.health() > 0 ? "+" : "-";
|
||||||
|
System.out.println(" Health: " + entity.Health + " " + color + sign + Math.abs(diff.health()) + TextColor.Reset);
|
||||||
|
|
||||||
|
color = diff.stamina() > 0 ? TextColor.Green : TextColor.Red;
|
||||||
|
sign = diff.stamina() > 0 ? "+" : "-";
|
||||||
|
System.out.println(" Stamina: " + entity.GetStamina() + " " + color + sign + Math.abs(diff.stamina()) + TextColor.Reset);
|
||||||
|
|
||||||
|
if (diff.lostShield()) {
|
||||||
|
System.out.println(" Shield: " + entity.Shield.getName() + " " + TextColor.Red + "LOST" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (diff.lostCostume()) {
|
||||||
|
System.out.println(" Costume: " + entity.Costume.getName() + " " + TextColor.Red + "LOST" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.Shield != null) {
|
||||||
|
color = diff.shieldHealth() > 0 ? TextColor.Green : TextColor.Red;
|
||||||
|
sign = diff.shieldHealth() > 0 ? "+" : "-";
|
||||||
|
System.out.println(" Shield: " + entity.Shield.getName() + " " + color + sign + Math.abs(diff.shieldHealth()) + TextColor.Reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.Costume != null) {
|
||||||
|
color = diff.costumeHealth() > 0 ? TextColor.Green : TextColor.Red;
|
||||||
|
sign = diff.costumeHealth() > 0 ? "+" : "-";
|
||||||
|
System.out.println(" Costume: " + entity.Costume.getName() + " " + color + sign + Math.abs(diff.shieldHealth()) + TextColor.Reset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private FightMoves PlayerMovesMenu() {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println(player.Name + " it's your turn");
|
||||||
|
ArrayList<FightMoves> moves = player.GetAvailableMoves();
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
Dictionary<Integer, FightMoves> dictionary = new Hashtable<>();
|
||||||
|
|
||||||
|
for (FightMoves move : moves) {
|
||||||
|
String result = index + " > " + move.toString();
|
||||||
|
|
||||||
|
if (move == FightMoves.SPECIAL) {
|
||||||
|
result += " (" + player.GetSpecialAbilityDescription(enemy) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
dictionary.put(index, move);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean continueLoop;
|
||||||
|
while (true){
|
||||||
|
continueLoop = false;
|
||||||
|
int choice = scanner.nextInt();
|
||||||
|
FightMoves move = moves.get(choice);
|
||||||
|
|
||||||
|
switch (move) {
|
||||||
|
case FightMoves.LIGHT_ATTACK -> player.LightAttack(enemy);
|
||||||
|
case FightMoves.HEAVY_ATTACK -> player.HeavyAttack(enemy);
|
||||||
|
case FightMoves.SPECIAL -> player.SpecialAbility(enemy);
|
||||||
|
case FightMoves.HEAL -> player.HealMove();
|
||||||
|
case FightMoves.DEFEND -> player.defend();
|
||||||
|
default -> continueLoop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!continueLoop) {
|
||||||
|
return move;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showMoveExplanation(FightMoves move, Entity performer, Entity receiver) {
|
||||||
|
System.out.print(TextColor.Cyan);
|
||||||
|
switch (move) {
|
||||||
|
case FightMoves.LIGHT_ATTACK -> System.out.println(performer.Name + " performs a light attack");
|
||||||
|
case FightMoves.HEAVY_ATTACK -> System.out.println(performer.Name + " performs a heavy attack");
|
||||||
|
case FightMoves.SPECIAL -> System.out.println(performer.GetSpecialAbilityResultDescription(receiver));
|
||||||
|
case FightMoves.HEAL -> System.out.println(performer.Name + " heals");
|
||||||
|
case FightMoves.DEFEND -> System.out.println(performer.Name + " get their guard up!");
|
||||||
|
}
|
||||||
|
System.out.print(TextColor.Reset);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,375 @@
|
|||||||
|
package org.project.engine;
|
||||||
|
|
||||||
|
import org.project.constants.appConstants.ConsoleColor;
|
||||||
|
import org.project.constants.appConstants.TextColor;
|
||||||
|
import org.project.constants.gameConstant.*;
|
||||||
|
import org.project.entity.players.Player;
|
||||||
|
import org.project.item.Accessory.Accessory;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Item;
|
||||||
|
import org.project.location.*;
|
||||||
|
import org.project.util.DisplayItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Dictionary;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class SinglePlayerEngine extends MainEngine {
|
||||||
|
private Player player;
|
||||||
|
|
||||||
|
public SinglePlayerEngine() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println(TextColor.Cyan + GetIntro() + ConsoleColor.Reset);
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("How should we call you, hero? ");
|
||||||
|
String name = scanner.nextLine();
|
||||||
|
|
||||||
|
System.out.println("Greetings, " + TextColor.Cyan + name + TextColor.Reset +". May we know your role? \n");
|
||||||
|
|
||||||
|
player = RoleMenu(name);
|
||||||
|
|
||||||
|
System.out.println("Very well, " + TextColor.Cyan + player.Name + ConsoleColor.Reset + " your journey begins!");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
boolean canFightDragon = player.GetInventoryByClass(ItemClass.KEY).size() == 3;
|
||||||
|
|
||||||
|
Location location = Location.RandomLocation();
|
||||||
|
|
||||||
|
boolean continueLoop = false;
|
||||||
|
do {
|
||||||
|
System.out.println(TextColor.Cyan + GetLocationIntro(location) + TextColor.Reset);
|
||||||
|
System.out.println("What do you do, " + player.Name + "?");
|
||||||
|
System.out.println(
|
||||||
|
"""
|
||||||
|
0 > FIGHT!
|
||||||
|
1 > Go to the next location
|
||||||
|
2 > Visit the market place in the town
|
||||||
|
3 > Check inventory"""
|
||||||
|
);
|
||||||
|
if (canFightDragon) {
|
||||||
|
System.out.println("4 > Go to the castle to face the dragon");
|
||||||
|
}
|
||||||
|
|
||||||
|
int choice = scanner.nextInt();
|
||||||
|
|
||||||
|
switch (choice) {
|
||||||
|
case 0 -> {
|
||||||
|
System.out.println(TextColor.Red + "You choice to FIGHT!" + TextColor.Reset);
|
||||||
|
BattleEngine engine = new SinglePlayerBattleEngine(player, location.enemy);
|
||||||
|
engine.StartBattle();
|
||||||
|
continueLoop = false;
|
||||||
|
}
|
||||||
|
case 1 -> {
|
||||||
|
continueLoop = false;
|
||||||
|
}
|
||||||
|
case 2 -> {
|
||||||
|
MarketPlace();
|
||||||
|
continueLoop = false;
|
||||||
|
}
|
||||||
|
case 3 -> {
|
||||||
|
InventoryView();
|
||||||
|
continueLoop = true;
|
||||||
|
}
|
||||||
|
case 4 -> {
|
||||||
|
if (canFightDragon) {
|
||||||
|
location = new Castle();
|
||||||
|
continueLoop = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continueLoop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default -> continueLoop = true;
|
||||||
|
}
|
||||||
|
} while (continueLoop);
|
||||||
|
|
||||||
|
if (player.GetState() == EntityState.DEAD) {
|
||||||
|
System.out.println(TextColor.Red + "Game Over!" + TextColor.Reset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.GetInventoryByClass(ItemClass.KEY).size() == 4) {
|
||||||
|
System.out.println(TextColor.Blue + "You WON! You saved Javanest!" + TextColor.Reset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String GetIntro() {
|
||||||
|
return "For centuries, the land of Javanest lived in peace, until a magical Dragon attacked, plunging the realm into absolute darkness. With a wicked curse, the Dragon transformed the innocent people into horrific monsters: Goblins, Skeletons, and Vampires. Retreating to its impenetrable Castle, the Dragon divided the three keys to its lair and hid them among these cursed creatures. Now, it is your duty to step up and save the land. You must battle these monsters, recover the unique key from each monster type, and finally slay the Dragon to break the curse and restore peace to Javanest!";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String GetLocationIntro(Location location) {
|
||||||
|
return switch (location) {
|
||||||
|
case Jungle jungle ->
|
||||||
|
player.Name + " enters the woods, after a few steps, they see a green goblin searching for food a few steps away";
|
||||||
|
case GraveYard graveYard ->
|
||||||
|
player.Name + " goes inside the grave ward, they cannot see further than 10 steps ahead because of the fog in the air. After lurking through out the graves, the shadow appears... It's a skeleton!";
|
||||||
|
case DarkCaves darkCaves ->
|
||||||
|
player.Name + " dives into the darkness. As our hero was going deeper, a black smoke appears, a vampire is nearby...";
|
||||||
|
case Castle castle ->
|
||||||
|
player.Name + " Goes through the gates, the dragon looks at " + player.Name + "... It knows that an epic battle awaits both it them";
|
||||||
|
case null, default -> "";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MarketPlace() {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println(TextColor.Cyan + "You've entered the marketplace, what would you like to do?" + TextColor.Reset);
|
||||||
|
boolean wantsToStay = true;
|
||||||
|
while (wantsToStay) {
|
||||||
|
System.out.println("Money = " + player.GetMoney() + "\n");
|
||||||
|
System.out.println("""
|
||||||
|
0 > Show Inventory
|
||||||
|
1 > Sell Unnecessary goods
|
||||||
|
2 > Sell the accessories
|
||||||
|
3 > Sell the shields
|
||||||
|
4 > Sell the costumes
|
||||||
|
5 > Sell the Weapons
|
||||||
|
6 > Buy shields
|
||||||
|
7 > Buy weapon
|
||||||
|
8 > Buy costume
|
||||||
|
9 > Exit
|
||||||
|
""");
|
||||||
|
|
||||||
|
int choice = scanner.nextInt();
|
||||||
|
|
||||||
|
switch (choice) {
|
||||||
|
case 0 -> {
|
||||||
|
if (player.GetInventory().isEmpty()) {
|
||||||
|
System.out.println(TextColor.Red + "You do not have anything at the moment" + TextColor.Reset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DisplayItem.DisplayItems(player.GetInventory());
|
||||||
|
}
|
||||||
|
case 1 -> {
|
||||||
|
player.SellByClass(ItemClass.UNNECESSARY);
|
||||||
|
System.out.println(TextColor.Green + "Unnecessary goods sold" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
case 2 -> {
|
||||||
|
player.SellByClass(ItemClass.ACCESSORY);
|
||||||
|
System.out.println(TextColor.Green + "accessories sold" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
case 3 -> {
|
||||||
|
player.SellByClass(ItemClass.SHIELD);
|
||||||
|
System.out.println(TextColor.Green + "shields sold" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
case 4 -> {
|
||||||
|
player.SellByClass(ItemClass.COSTUME);
|
||||||
|
System.out.println(TextColor.Green + "costumes sold" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
case 5 -> {
|
||||||
|
player.SellByClass(ItemClass.WEAPON);
|
||||||
|
System.out.println(TextColor.Green + "weapons sold" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
case 6 -> {
|
||||||
|
System.out.println("Money = " + player.GetMoney() + "\n");
|
||||||
|
|
||||||
|
System.out.println(TextColor.Blue + "Current shield: ");
|
||||||
|
ArrayList<Item> item = new ArrayList<>();
|
||||||
|
if (player.Shield == null) {
|
||||||
|
System.out.println(TextColor.Red + "You do not have a Shield" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item.add(player.Shield);
|
||||||
|
DisplayItem.DisplayItems(item);
|
||||||
|
}
|
||||||
|
System.out.println(TextColor.Reset);
|
||||||
|
|
||||||
|
ArrayList<Item> items = new ArrayList<>(Arrays.asList(Shields.getShields()));
|
||||||
|
Dictionary<Integer, Item> dictionary = DisplayItem.MenuDisplay(items);
|
||||||
|
|
||||||
|
System.out.println("Please set the number of the accessory you want to buy, set any other number to abort:");
|
||||||
|
Integer index = scanner.nextInt();
|
||||||
|
Item shield = dictionary.get(index);
|
||||||
|
Accessory accessory = (Accessory) shield;
|
||||||
|
|
||||||
|
if (accessory != null) {
|
||||||
|
if (player.GetMoney() >= accessory.GetPrice()) {
|
||||||
|
if (player.Shield != null) player.Shield.DeattachFrom(player, true);
|
||||||
|
accessory.AttachTo(player, false);
|
||||||
|
player.ModifyMoney(accessory.GetPrice(), false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println(TextColor.Red + "You do not have enough money" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 7 -> {
|
||||||
|
System.out.println("Money = " + player.GetMoney() + "\n");
|
||||||
|
|
||||||
|
System.out.println(TextColor.Blue + "Current weapon: ");
|
||||||
|
ArrayList<Item> item = new ArrayList<>();
|
||||||
|
if (player.Weapon == null) {
|
||||||
|
System.out.println(TextColor.Red + "You do not have a Weapon" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item.add(player.Weapon);
|
||||||
|
DisplayItem.DisplayItems(item);
|
||||||
|
}
|
||||||
|
System.out.println(TextColor.Reset);
|
||||||
|
|
||||||
|
ArrayList<Item> items = new ArrayList<>(Arrays.asList(Weapons.getWeapons()));
|
||||||
|
Dictionary<Integer, Item> dictionary = DisplayItem.MenuDisplay(items);
|
||||||
|
|
||||||
|
System.out.println("Please set the number of the accessory you want to buy, set any other number to abort:");
|
||||||
|
Integer index = scanner.nextInt();
|
||||||
|
Item weapon = dictionary.get(index);
|
||||||
|
Accessory accessory = (Accessory) weapon;
|
||||||
|
|
||||||
|
if (accessory != null) {
|
||||||
|
if (player.GetMoney() >= accessory.GetPrice()) {
|
||||||
|
if (player.Weapon != null) player.Weapon.DeattachFrom(player, true);
|
||||||
|
accessory.AttachTo(player, false);
|
||||||
|
player.ModifyMoney(accessory.GetPrice(), false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println(TextColor.Red + "You do not have enough money" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 8 -> {
|
||||||
|
System.out.println("Money = " + player.GetMoney() + "\n");
|
||||||
|
|
||||||
|
System.out.println(TextColor.Blue + "Current costume: ");
|
||||||
|
ArrayList<Item> item = new ArrayList<>();
|
||||||
|
if (player.Costume == null) {
|
||||||
|
System.out.println(TextColor.Red + "You do not have a Costume" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item.add(player.Costume);
|
||||||
|
DisplayItem.DisplayItems(item);
|
||||||
|
}
|
||||||
|
System.out.println(TextColor.Reset);
|
||||||
|
|
||||||
|
ArrayList<Item> items = new ArrayList<>(Arrays.asList(Costumes.getCostumes()));
|
||||||
|
Dictionary<Integer, Item> dictionary = DisplayItem.MenuDisplay(items);
|
||||||
|
|
||||||
|
System.out.println("Please set the number of the accessory you want to buy, set any other number to abort:");
|
||||||
|
Integer index = scanner.nextInt();
|
||||||
|
Item costume = dictionary.get(index);
|
||||||
|
Accessory accessory = (Accessory) costume;
|
||||||
|
|
||||||
|
if (accessory != null) {
|
||||||
|
if (player.GetMoney() >= accessory.GetPrice()) {
|
||||||
|
if (player.Costume != null) player.Costume.DeattachFrom(player, true);
|
||||||
|
accessory.AttachTo(player, false);
|
||||||
|
player.ModifyMoney(accessory.GetPrice(), false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println(TextColor.Red + "You do not have enough money" + TextColor.Reset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 9 -> wantsToStay = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InventoryView() {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println(TextColor.Cyan + "You open your inventory, what would you like to do?\n" + TextColor.Reset);
|
||||||
|
|
||||||
|
boolean wantsToStay = true;
|
||||||
|
while (wantsToStay) {
|
||||||
|
System.out.println("Money = " + player.GetMoney() + "\n");
|
||||||
|
System.out.println("""
|
||||||
|
0 > Show Inventory
|
||||||
|
1 > Show Shields
|
||||||
|
2 > Show Weapons
|
||||||
|
3 > Show Costumes
|
||||||
|
4 > Exit
|
||||||
|
""");
|
||||||
|
|
||||||
|
int choice = scanner.nextInt();
|
||||||
|
|
||||||
|
switch (choice) {
|
||||||
|
case 0 -> {
|
||||||
|
if (player.GetInventory().isEmpty()) {
|
||||||
|
System.out.println(TextColor.Red + "You do not have anything at the moment" + TextColor.Reset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DisplayItem.DisplayItems(player.GetInventory());
|
||||||
|
}
|
||||||
|
case 1 -> {
|
||||||
|
System.out.println(TextColor.Blue + "Current shield: ");
|
||||||
|
ArrayList<Item> item = new ArrayList<>();
|
||||||
|
if (player.Shield == null) {
|
||||||
|
System.out.println(TextColor.Red + "You do not have a Shield" + TextColor.Reset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
item.add(player.Shield);
|
||||||
|
DisplayItem.DisplayItems(item);
|
||||||
|
System.out.println(TextColor.Reset);
|
||||||
|
|
||||||
|
Dictionary<Integer, Item> dictionary = DisplayItem.MenuDisplay(player.GetInventoryByClass(ItemClass.SHIELD));
|
||||||
|
|
||||||
|
System.out.println("Please set the number of the accessory you want to wear, set any other number to abort:");
|
||||||
|
Integer index = scanner.nextInt();
|
||||||
|
Item shield = dictionary.get(index);
|
||||||
|
|
||||||
|
if (shield != null) {
|
||||||
|
if (player.Shield != null) player.Shield.DeattachFrom(player, true);
|
||||||
|
((Accessory) shield).AttachTo(player, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 2 -> {
|
||||||
|
System.out.println(TextColor.Blue + "Current weapon: ");
|
||||||
|
ArrayList<Item> item = new ArrayList<>();
|
||||||
|
if (player.Weapon == null) {
|
||||||
|
System.out.println(TextColor.Red + "You do not have a Weapon" + TextColor.Reset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
item.add(player.Weapon);
|
||||||
|
DisplayItem.DisplayItems(item);
|
||||||
|
System.out.println(TextColor.Reset);
|
||||||
|
|
||||||
|
Dictionary<Integer, Item> dictionary = DisplayItem.MenuDisplay(player.GetInventoryByClass(ItemClass.WEAPON));
|
||||||
|
|
||||||
|
System.out.println("Please set the number of the accessory you want to wear, set any other number to abort:");
|
||||||
|
Integer index = scanner.nextInt();
|
||||||
|
Item weapon = dictionary.get(index);
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
if (player.Weapon != null) player.Weapon.DeattachFrom(player, true);
|
||||||
|
((Accessory) weapon).AttachTo(player, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 3 -> {
|
||||||
|
System.out.println(TextColor.Blue + "Current costume: ");
|
||||||
|
ArrayList<Item> item = new ArrayList<>();
|
||||||
|
if (player.Costume == null) {
|
||||||
|
System.out.println(TextColor.Red + "You do not have a Costume" + TextColor.Reset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
item.add(player.Costume);
|
||||||
|
DisplayItem.DisplayItems(item);
|
||||||
|
System.out.println(TextColor.Reset);
|
||||||
|
|
||||||
|
Dictionary<Integer, Item> dictionary = DisplayItem.MenuDisplay(player.GetInventoryByClass(ItemClass.COSTUME));
|
||||||
|
|
||||||
|
System.out.println("Please set the number of the accessory you want to wear, set any other number to abort:");
|
||||||
|
Integer index = scanner.nextInt();
|
||||||
|
Item costume = dictionary.get(index);
|
||||||
|
|
||||||
|
if (costume != null) {
|
||||||
|
if (player.Costume != null) player.Costume.DeattachFrom(player, true);
|
||||||
|
((Accessory) costume).AttachTo(player, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 4 -> wantsToStay = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,278 @@
|
|||||||
package org.project.entity;
|
package org.project.entity;
|
||||||
|
|
||||||
public interface Entity {
|
import org.project.Interface.*;
|
||||||
void attack(Entity target);
|
import org.project.constants.gameConstant.*;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
import org.project.item.SellableItem;
|
||||||
|
|
||||||
void defend();
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
void heal(int health);
|
public abstract class Entity implements IDamageable, IHealable, IDefendable, IFighter, IDamager {
|
||||||
|
|
||||||
void fillMana(int mana);
|
public String Name;
|
||||||
|
public int MaxHealth;
|
||||||
|
public int Health;
|
||||||
|
private int Stamina;
|
||||||
|
protected int MaxStamina;
|
||||||
|
private long Money;
|
||||||
|
protected int BaseDamage;
|
||||||
|
private EntityState State;
|
||||||
|
public Weapon Weapon;
|
||||||
|
public Shield Shield;
|
||||||
|
public Costume Costume;
|
||||||
|
public ArrayList<Item> Inventory;
|
||||||
|
protected int DefenseBonus;
|
||||||
|
public boolean IsDefending;
|
||||||
|
public ArrayList<DefencePowerUp> defencePowerUps;
|
||||||
|
protected int HealAmount;
|
||||||
|
protected int HeavyAttackStamina;
|
||||||
|
protected int SpecialAbilityStamina;
|
||||||
|
|
||||||
void takeDamage(int damage);
|
public Entity(String name, int maxHealth, int health, int stamina, int maxStamina, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending, int healAmount) {
|
||||||
|
|
||||||
int getMaxHP();
|
Name = name;
|
||||||
|
MaxHealth = maxHealth;
|
||||||
|
Health = health;
|
||||||
|
Stamina = stamina;
|
||||||
|
MaxStamina = maxStamina;
|
||||||
|
Money = money;
|
||||||
|
BaseDamage = baseDamage;
|
||||||
|
State = state;
|
||||||
|
Weapon = weapon;
|
||||||
|
Shield = shield;
|
||||||
|
Costume = costume;
|
||||||
|
Inventory = inventory;
|
||||||
|
DefenseBonus = defenseBonus;
|
||||||
|
IsDefending = isDefending;
|
||||||
|
HealAmount = healAmount;
|
||||||
|
HeavyAttackStamina = 50;
|
||||||
|
SpecialAbilityStamina = 100;
|
||||||
|
}
|
||||||
|
|
||||||
int getMaxMP();
|
protected Entity() {}
|
||||||
|
|
||||||
/*
|
public Entity(Entity other) {
|
||||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
this.Name = other.Name;
|
||||||
*/
|
this.MaxHealth = other.MaxHealth;
|
||||||
|
this.Health = other.Health;
|
||||||
|
this.Stamina = other.Stamina;
|
||||||
|
this.MaxStamina = other.MaxStamina;
|
||||||
|
this.Money = other.Money;
|
||||||
|
this.BaseDamage = other.BaseDamage;
|
||||||
|
this.State = other.State;
|
||||||
|
|
||||||
|
this.Weapon = other.Weapon == null ? null : new Weapon(other.Weapon.getName(), this, other.Weapon.GetPrice(), other.Weapon.GetHealth(), other.Weapon.GetMaxHealth(), other.Weapon.GetDamage());
|
||||||
|
this.Shield = other.Shield == null ? null : new Shield(other.Shield.getName(), this, other.Shield.GetPrice(), other.Shield.GetHealth(), other.Shield.GetMaxHealth(), other.Shield.GetDefense());
|
||||||
|
this.Costume = other.Costume == null ? null : new Costume(other.Costume.getName(), this, other.Costume.GetPrice(), other.Costume.GetHealth(), other.Costume.GetMaxHealth(), other.Costume.GetDefense());
|
||||||
|
|
||||||
|
this.Inventory = other.Inventory == null ? null : new ArrayList<>(other.Inventory);
|
||||||
|
this.defencePowerUps = other.defencePowerUps == null ? null : new ArrayList<>(other.defencePowerUps);
|
||||||
|
|
||||||
|
this.DefenseBonus = other.DefenseBonus;
|
||||||
|
this.IsDefending = other.IsDefending;
|
||||||
|
this.HealAmount = other.HealAmount;
|
||||||
|
this.HeavyAttackStamina = other.HeavyAttackStamina;
|
||||||
|
this.SpecialAbilityStamina = other.SpecialAbilityStamina;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Entity copy();
|
||||||
|
|
||||||
|
public int GetStamina() { return Stamina; }
|
||||||
|
|
||||||
|
public void ResetStamina() { Stamina = MaxStamina; }
|
||||||
|
|
||||||
|
public void ModifyStamina(int amount, boolean dir) {
|
||||||
|
if (dir) {
|
||||||
|
Stamina += amount;
|
||||||
|
|
||||||
|
if (Stamina > MaxStamina) {
|
||||||
|
Stamina = MaxStamina;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Stamina -= amount;
|
||||||
|
if (Stamina < 0) {
|
||||||
|
Stamina = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityState GetState() { return State; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int GetDamage() {
|
||||||
|
int damage = BaseDamage;
|
||||||
|
IDamageUtil[] utils = GetDamageUtils();
|
||||||
|
|
||||||
|
for (IDamageUtil util : utils) {
|
||||||
|
if (util != null) {
|
||||||
|
damage += util.GetDamage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IDamageUtil[] GetDamageUtils() {
|
||||||
|
return new IDamageUtil[] {Weapon};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Damage(IDamageable target, int amount, AttackPowerUp[] powerUps) {
|
||||||
|
target.TakeDamage(amount, powerUps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long GetMoney() { return Money; }
|
||||||
|
|
||||||
|
public ArrayList<Item> GetInventory() { return Inventory; }
|
||||||
|
|
||||||
|
public ArrayList<Item> GetInventoryByClass(ItemClass itemClass) {
|
||||||
|
ArrayList<Item> result = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Item item : Inventory) {
|
||||||
|
if (ItemClassExt.Matches(itemClass, item)) {
|
||||||
|
result.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetState(EntityState state) {
|
||||||
|
State = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ModifyMoney(long amount, boolean dir) {
|
||||||
|
if (dir) {
|
||||||
|
Money += amount;
|
||||||
|
}
|
||||||
|
Money -= amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RestoreHealth() { Health = MaxHealth; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Heal(int amount) {
|
||||||
|
Health += amount;
|
||||||
|
|
||||||
|
if (Health > MaxHealth) {
|
||||||
|
Health = MaxHealth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IDefender[] GetDefenders() {
|
||||||
|
return new IDefender[]{Shield, Costume};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void TakeDamage(int amount, AttackPowerUp[] powerUps) {
|
||||||
|
if (defencePowerUps != null && !defencePowerUps.contains(DefencePowerUp.INVISIBLE)) return;
|
||||||
|
|
||||||
|
IDefender[] defenders = GetDefenders();
|
||||||
|
|
||||||
|
if (Arrays.binarySearch(powerUps, AttackPowerUp.INEVITABLE) < 0) {
|
||||||
|
for (IDefender defender : defenders) {
|
||||||
|
if (defender != null) {
|
||||||
|
amount = defender.Apply(amount, powerUps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsDefending) {
|
||||||
|
if (Arrays.binarySearch(powerUps, AttackPowerUp.INEVITABLE) < 0) {
|
||||||
|
amount -= DefenseBonus;
|
||||||
|
}
|
||||||
|
IsDefending = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amount > 0) {
|
||||||
|
Health -= amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsDestroyed()) {
|
||||||
|
HandleZeroHealth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean IsDestroyed() {
|
||||||
|
return Health <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void HandleZeroHealth() {
|
||||||
|
this.State = EntityState.DEAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SellItem(SellableItem item) {
|
||||||
|
int price = item.GetPrice();
|
||||||
|
RemoveFromInventory(item);
|
||||||
|
|
||||||
|
Money += price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SellByClass(ItemClass itemClass) {
|
||||||
|
ArrayList<Item> items = GetInventoryByClass(itemClass);
|
||||||
|
|
||||||
|
for (Item item : items) {
|
||||||
|
SellItem((SellableItem) item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddToInventory(Item item) {
|
||||||
|
Inventory.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveFromInventory(Item item) {
|
||||||
|
Inventory.remove(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void LightAttack(IDamageable target);
|
||||||
|
@Override
|
||||||
|
public abstract void HeavyAttack(IDamageable target);
|
||||||
|
@Override
|
||||||
|
public void defend() {
|
||||||
|
IsDefending = true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void HealMove() {
|
||||||
|
Heal(HealAmount);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public abstract void SpecialAbility(Entity entity);
|
||||||
|
@Override
|
||||||
|
public abstract String GetSpecialAbilityDescription(Entity entity);
|
||||||
|
@Override
|
||||||
|
public abstract String GetSpecialAbilityResultDescription(Entity entity);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<FightMoves> GetAvailableMoves() {
|
||||||
|
if (GetState() == EntityState.FROZEN || GetState() == EntityState.DEAD) return new ArrayList<>(){};
|
||||||
|
|
||||||
|
ArrayList<FightMoves> result = new ArrayList<>();
|
||||||
|
result.add(FightMoves.DEFEND);
|
||||||
|
result.add(FightMoves.LIGHT_ATTACK);
|
||||||
|
|
||||||
|
if (Health < MaxHealth) {
|
||||||
|
result.add(FightMoves.HEAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Stamina > MaxStamina / 2) {
|
||||||
|
result.add(FightMoves.SPECIAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Stamina > MaxStamina / 4) {
|
||||||
|
result.add(FightMoves.HEAVY_ATTACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package org.project.entity.enemies;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.entity.players.Player;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
import org.project.item.KeyItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Dragon extends Enemy {
|
||||||
|
public Dragon (String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int levelProgressAmount) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina, levelProgressAmount);
|
||||||
|
|
||||||
|
this.Key = new KeyItem("Dragon Key", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dragon() {
|
||||||
|
this("Dragon", 5000, 5000, 0, 100, EntityState.ALIVE, null, null, null, new ArrayList<>(){}, 50, false, 50, 500, 500, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dragon (Dragon other) {
|
||||||
|
super(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dragon copy() {
|
||||||
|
return new Dragon(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DropLoot(Player player) {
|
||||||
|
Key.Owner = player;
|
||||||
|
player.AddToInventory(Key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void SpecialAbility(Entity entity) {
|
||||||
|
ModifyStamina(SpecialAbilityStamina, false);
|
||||||
|
Damage(entity, GetDamage() * 2, new AttackPowerUp[]{AttackPowerUp.INEVITABLE, AttackPowerUp.ANTI_SHIELD});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityDescription(Entity entity) {
|
||||||
|
return "Dragon will throw its fiery breath towards " + entity.Name + ". No defense and shield will help";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||||
|
if (entity.IsDefending) {
|
||||||
|
return "Dragon will threw its fiery breath towards " + entity.Name + ". " + entity.Name + " tries to defend against it, but there's no use";
|
||||||
|
}
|
||||||
|
return "Dragon will threw its fiery breath towards " + entity.Name + ". To " + entity.Name + " surprise, their shield had no use";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,34 +1,129 @@
|
|||||||
package org.project.entity.enemies;
|
package org.project.entity.enemies;
|
||||||
|
|
||||||
import org.project.item.weapons.Weapon;
|
import org.project.Interface.IDamageable;
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
|
import org.project.constants.gameConstant.FightMoves;
|
||||||
|
import org.project.constants.gameConstant.ItemClass;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.entity.players.Player;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
import org.project.item.KeyItem;
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
import java.util.ArrayList;
|
||||||
public abstract class Enemy {
|
import java.util.Arrays;
|
||||||
Weapon weapon;
|
import java.util.Objects;
|
||||||
private int hp;
|
import java.util.Random;
|
||||||
private int mp;
|
|
||||||
|
|
||||||
public Enemy(int hp, int mp, Weapon weapon) {
|
public abstract class Enemy extends Entity {
|
||||||
this.hp = hp;
|
protected KeyItem Key;
|
||||||
this.mp = mp;
|
public int LevelProgressAmount;
|
||||||
|
|
||||||
this.weapon = weapon;
|
public Enemy (String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int levelProgressAmount) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, stamina, maxStamina, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount);
|
||||||
|
|
||||||
|
Key = new KeyItem(null, this);
|
||||||
|
LevelProgressAmount = levelProgressAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Enemy() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enemy(Enemy other) {
|
||||||
|
super(other);
|
||||||
|
this.Key = new KeyItem(other.Key.getName(), other.Key.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void takeDamage(int damage) {
|
public abstract Enemy copy();
|
||||||
hp -= damage;
|
|
||||||
|
public void DropLoot(Player player) {
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
|
for (Item item : Inventory) {
|
||||||
|
int change = random.nextInt(2);
|
||||||
|
|
||||||
|
if (change == 0) {
|
||||||
|
player.AddToInventory(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Item> keys = player.GetInventoryByClass(ItemClass.KEY);
|
||||||
|
if (keys.stream().noneMatch(obj -> Objects.equals(obj.getName(), Key.getName()))) {
|
||||||
|
int chance = random.nextInt(5);
|
||||||
|
|
||||||
|
if (chance == 0) {
|
||||||
|
Key.Owner = player;
|
||||||
|
player.AddToInventory(Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.ModifyMoney(GetMoney(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHp() {
|
public FightMoves PlayRound(Player player) {
|
||||||
return hp;
|
ArrayList<FightMoves> moves = GetAvailableMoves();
|
||||||
|
Random random = new Random();
|
||||||
|
int change = random.nextInt(4);
|
||||||
|
|
||||||
|
if (change == 0 && moves.contains(FightMoves.HEAL)) {
|
||||||
|
HealMove();
|
||||||
|
return FightMoves.HEAL;
|
||||||
|
}
|
||||||
|
else if (change == 1 && moves.contains(FightMoves.DEFEND)) {
|
||||||
|
defend();
|
||||||
|
return FightMoves.DEFEND;
|
||||||
|
}
|
||||||
|
else if (moves.contains(FightMoves.SPECIAL)) {
|
||||||
|
SpecialAbility(player);
|
||||||
|
return FightMoves.SPECIAL;
|
||||||
|
}
|
||||||
|
else if (moves.contains(FightMoves.HEAVY_ATTACK)) {
|
||||||
|
HeavyAttack(player);
|
||||||
|
return FightMoves.HEAVY_ATTACK;
|
||||||
|
}
|
||||||
|
else if (moves.contains(FightMoves.LIGHT_ATTACK)) {
|
||||||
|
LightAttack(player);
|
||||||
|
return FightMoves.LIGHT_ATTACK;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMp() {
|
@Override
|
||||||
return mp;
|
public void LightAttack(IDamageable target) {
|
||||||
|
int damage = GetDamage();
|
||||||
|
|
||||||
|
Damage(target, (int)(damage * 0.4), new AttackPowerUp[]{});
|
||||||
|
ModifyStamina(MaxStamina/8, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Weapon getWeapon() {
|
@Override
|
||||||
return weapon;
|
public void HeavyAttack(IDamageable target) {
|
||||||
|
int damage = GetDamage();
|
||||||
|
ModifyStamina(HeavyAttackStamina, false);
|
||||||
|
|
||||||
|
Damage(target, (int)(damage * 0.9), new AttackPowerUp[]{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void HealMove() {
|
||||||
|
super.HealMove();
|
||||||
|
ModifyStamina(MaxStamina/4, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void SpecialAbility(Entity entity);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract String GetSpecialAbilityDescription(Entity entity);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract String GetSpecialAbilityResultDescription(Entity entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package org.project.entity.enemies;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
import org.project.item.KeyItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Goblin extends Enemy {
|
||||||
|
public Goblin (String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int levelProgressAmount) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina, levelProgressAmount);
|
||||||
|
|
||||||
|
this.Key = new KeyItem("Goblin Key", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Goblin() {
|
||||||
|
this("Goblin", 75, 75, 100, 10, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 15, 100, 100, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Goblin (Goblin other) {
|
||||||
|
super(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Goblin copy() {
|
||||||
|
return new Goblin(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void SpecialAbility(Entity entity) {
|
||||||
|
ModifyStamina(SpecialAbilityStamina, false);
|
||||||
|
Damage(entity, GetDamage() * 4, new AttackPowerUp[]{});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityDescription(Entity entity) {
|
||||||
|
return "Goblin will rage and cause a critical damage to " + entity.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||||
|
return "Goblin looks at " + entity.Name + ", its eyes are red... He rages and charges " + entity.Name + " with all of its power";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,100 @@
|
|||||||
package org.project.entity.enemies;
|
package org.project.entity.enemies;
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
import org.project.constants.gameConstant.EntityState;
|
||||||
public class Skeleton {
|
import org.project.constants.gameConstant.FightMoves;
|
||||||
// TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR
|
import org.project.entity.Entity;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
import org.project.item.KeyItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class Skeleton extends Enemy {
|
||||||
|
|
||||||
|
boolean HasRevived = false;
|
||||||
|
|
||||||
|
public Skeleton (String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int levelProgressAmount) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina, levelProgressAmount);
|
||||||
|
|
||||||
|
this.Key = new KeyItem("Skeleton Key", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Skeleton() {
|
||||||
|
this("Skeleton", 125, 125, 200, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 20, 100, 100, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Skeleton (Skeleton other) {
|
||||||
|
super(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Skeleton copy() {
|
||||||
|
return new Skeleton(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<FightMoves> GetAvailableMoves() {
|
||||||
|
if (GetState() == EntityState.FROZEN || GetState() == EntityState.DEAD) return new ArrayList<>(){};
|
||||||
|
|
||||||
|
ArrayList<FightMoves> result = new ArrayList<>();
|
||||||
|
|
||||||
|
if (GetState() == EntityState.DOWNED) {
|
||||||
|
if (GetStamina() > MaxStamina / 2 && !HasRevived) {
|
||||||
|
Random random = new Random();
|
||||||
|
int chance = random.nextInt(2);
|
||||||
|
if (chance == 0) {
|
||||||
|
result.add(FightMoves.SPECIAL);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
HandleZeroHealth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.add(FightMoves.DEFEND);
|
||||||
|
result.add(FightMoves.LIGHT_ATTACK);
|
||||||
|
|
||||||
|
if (Health < MaxHealth) {
|
||||||
|
result.add(FightMoves.HEAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetStamina() > MaxStamina / 4) {
|
||||||
|
result.add(FightMoves.HEAVY_ATTACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void HandleZeroHealth() {
|
||||||
|
if (GetState() == EntityState.DOWNED) {
|
||||||
|
SetState(EntityState.DEAD);
|
||||||
|
}
|
||||||
|
SetState(EntityState.DOWNED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void SpecialAbility(Entity entity) {
|
||||||
|
SetState(EntityState.ALIVE);
|
||||||
|
Health = MaxHealth / 2;
|
||||||
|
HasRevived = true;
|
||||||
|
entity.SetState(EntityState.FROZEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityDescription(Entity entity) {
|
||||||
|
return "Skeleton refuses to die and revives";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||||
|
return "Just as " + entity.Name + " made sure of their victory. The bones started to shake, they gathered once more for Skeleton to shape. \"You need more thank that to kill me\" Says the skeleton";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package org.project.entity.enemies;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
import org.project.item.KeyItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Vampire extends Enemy {
|
||||||
|
public Vampire (String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int levelProgressAmount) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina, levelProgressAmount);
|
||||||
|
|
||||||
|
this.Key = new KeyItem("Vampire Key", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vampire() {
|
||||||
|
this("Vampire", 150, 150, 300, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100, 150);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vampire (Vampire other) {
|
||||||
|
super(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vampire copy() {
|
||||||
|
return new Vampire(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void SpecialAbility(Entity entity) {
|
||||||
|
int curHealth = entity.Health;
|
||||||
|
ModifyStamina(SpecialAbilityStamina, false);
|
||||||
|
Damage(entity, GetDamage(), new AttackPowerUp[]{AttackPowerUp.INEVITABLE});
|
||||||
|
Heal(curHealth - entity.Health);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityDescription(Entity entity) {
|
||||||
|
return "Vampire will suck the blood out of " + entity.Name + " and heal themselves while hurting the enemy";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||||
|
return "Vampire attacked " + entity.Name + " and sucked his blood out of his veins. He seems more powerful";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package org.project.entity.players;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Assassin extends Player {
|
||||||
|
public Assassin(String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int level, int levelProgress) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina, level, levelProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Assassin(String name, int level) {
|
||||||
|
this(name);
|
||||||
|
LevelUpTo(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Assassin(String name) {
|
||||||
|
this(name, 125, 125, 100, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 35, 100, 100, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Assassin(Assassin other) {
|
||||||
|
super(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Assassin copy() {
|
||||||
|
return new Assassin(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void SpecialAbility(Entity entity) {
|
||||||
|
ModifyStamina(SpecialAbilityStamina, false);
|
||||||
|
Damage(entity, GetDamage() * 3, new AttackPowerUp[]{AttackPowerUp.NO_DEFENSE});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityDescription(Entity entity) {
|
||||||
|
return "Turn invisible and cause a critical damage to " + entity.Name + ". Your enemy cannot defend your attack \n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||||
|
if (entity.IsDefending) {
|
||||||
|
return entity.Name + " Holds their guard up, but you strike them from another direction";
|
||||||
|
}
|
||||||
|
return "\"Show Yourself coward\" Says " + entity.Name + " As they helplessly try to hit you. But their eyes cannot find you no matter how hard they try";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,59 @@
|
|||||||
package org.project.entity.players;
|
package org.project.entity.players;
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
public class Knight {
|
import org.project.constants.gameConstant.EntityState;
|
||||||
// TODO: DESIGN KNIGHT'S WEAPON AND ARMOR AND IMPLEMENT THE CONSTRUCTOR
|
import org.project.entity.Entity;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Knight extends Player {
|
||||||
|
public Knight(String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int level, int levelProgress) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina, level, levelProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Knight(String name, int level) {
|
||||||
|
this(name);
|
||||||
|
LevelUpTo(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Knight(String name) {
|
||||||
|
this(name, 150, 150, 100, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Knight(Knight other) {
|
||||||
|
super(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Knight copy() {
|
||||||
|
return new Knight(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void SpecialAbility(Entity entity) {
|
||||||
|
ModifyStamina(SpecialAbilityStamina, false);
|
||||||
|
Damage(entity, GetDamage(), new AttackPowerUp[]{});
|
||||||
|
entity.SetState(EntityState.FROZEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityDescription(Entity entity) {
|
||||||
|
return "Slam " + entity.Name + " with your unstoppable strength and stun them for the next turn";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||||
|
if (entity.IsDefending) {
|
||||||
|
return "You slammed " + entity.Name + ", they try to defend, but they were thrown to the ground";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "You slammed " + entity.Name + ", your enemy seems deezy";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,89 +1,105 @@
|
|||||||
package org.project.entity.players;
|
package org.project.entity.players;
|
||||||
|
|
||||||
|
import org.project.Interface.IDamageable;
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
import org.project.item.armors.Armor;
|
import org.project.item.Accessory.Costume;
|
||||||
import org.project.item.weapons.Weapon;
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
import java.util.ArrayList;
|
||||||
public abstract class Player {
|
|
||||||
protected String name;
|
|
||||||
Weapon weapon;
|
|
||||||
Armor armor;
|
|
||||||
private int hp;
|
|
||||||
private int maxHP;
|
|
||||||
private int mp;
|
|
||||||
private int maxMP;
|
|
||||||
|
|
||||||
public Player(String name, int hp, int mp, Weapon weapon, Armor armor) {
|
public abstract class Player extends Entity {
|
||||||
this.name = name;
|
public int Level;
|
||||||
this.hp = hp;
|
private int LevelProgress;
|
||||||
this.mp = mp;
|
|
||||||
|
|
||||||
this.weapon = weapon;
|
public Player (String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
this.armor = armor;
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int level, int levelProgress) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, stamina, maxStamina, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount);
|
||||||
|
|
||||||
|
Level = level;
|
||||||
|
LevelProgress = levelProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Player() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player(Player other) {
|
||||||
|
super(other);
|
||||||
|
this.Level = other.Level;
|
||||||
|
this.LevelProgress = other.LevelProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attack(Entity target) {
|
public abstract Player copy();
|
||||||
target.takeDamage(weapon.getDamage());
|
|
||||||
|
public void LevelUpTo(int level) {
|
||||||
|
while (Level < level) {
|
||||||
|
UnconditionalLevelUp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void AddLevelProgress(int amount) {
|
||||||
public void defend() {
|
LevelProgress += amount;
|
||||||
// TODO
|
|
||||||
|
if (LevelProgress >= 100) {
|
||||||
|
LevelUp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UnconditionalLevelUp() {
|
||||||
|
Level++;
|
||||||
|
double upgradeRatio = (1.1 + ((double) Level * 0.02));
|
||||||
|
int gift = Level * 10;
|
||||||
|
|
||||||
@Override
|
MaxStamina = (int) (MaxStamina * upgradeRatio);
|
||||||
public void takeDamage(int damage) {
|
MaxHealth = (int) (MaxHealth * upgradeRatio);
|
||||||
hp -= damage - armor.getDefense();
|
BaseDamage = (int) (BaseDamage * upgradeRatio);
|
||||||
|
DefenseBonus = (int) (DefenseBonus * upgradeRatio);
|
||||||
|
HealAmount = (int) (HealAmount * upgradeRatio);
|
||||||
|
ModifyMoney(gift, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void LevelUp() {
|
||||||
public void heal(int health) {
|
while (LevelProgress >= 100) {
|
||||||
hp += health;
|
UnconditionalLevelUp();
|
||||||
if (hp > maxHP) {
|
LevelProgress -= 100;
|
||||||
hp = maxHP;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillMana(int mana) {
|
public void LightAttack(IDamageable target) {
|
||||||
mp += mana;
|
int damage = GetDamage();
|
||||||
if (mp > maxMP) {
|
|
||||||
mp = maxMP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Damage(target, (int)(damage * 0.5), new AttackPowerUp[]{});
|
||||||
public String getName() {
|
ModifyStamina(MaxStamina/8, false);
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHp() {
|
|
||||||
return hp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxHP() {
|
public void HeavyAttack(IDamageable target) {
|
||||||
return maxHP;
|
int damage = GetDamage();
|
||||||
}
|
|
||||||
|
|
||||||
public int getMp() {
|
Damage(target, damage, new AttackPowerUp[]{});
|
||||||
return mp;
|
ModifyStamina(HeavyAttackStamina, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMP() {
|
public void HealMove() {
|
||||||
return maxMP;
|
super.HealMove();
|
||||||
|
ModifyStamina(MaxStamina/4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Weapon getWeapon() {
|
@Override
|
||||||
return weapon;
|
public abstract void SpecialAbility(Entity entity);
|
||||||
}
|
|
||||||
|
|
||||||
public Armor getArmor() {
|
@Override
|
||||||
return armor;
|
public abstract String GetSpecialAbilityDescription(Entity entity);
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract String GetSpecialAbilityResultDescription(Entity entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package org.project.entity.players;
|
||||||
|
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.constants.gameConstant.EntityState;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.item.Accessory.Costume;
|
||||||
|
import org.project.item.Accessory.Shield;
|
||||||
|
import org.project.item.Accessory.Weapon;
|
||||||
|
import org.project.item.Item;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Wizard extends Player {
|
||||||
|
public Wizard(String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||||
|
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||||
|
int healAmount, int stamina, int maxStamina, int level, int levelProgress) {
|
||||||
|
|
||||||
|
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina, level, levelProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wizard(String name, int level) {
|
||||||
|
this(name);
|
||||||
|
LevelUpTo(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wizard(String name) {
|
||||||
|
this(name, 100, 100, 100, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 40, 100, 100, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wizard(Wizard other) {
|
||||||
|
super(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Wizard copy() {
|
||||||
|
return new Wizard(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void SpecialAbility(Entity entity) {
|
||||||
|
ModifyStamina(SpecialAbilityStamina, false);
|
||||||
|
Damage(entity, GetDamage() * 3, new AttackPowerUp[]{AttackPowerUp.INEVITABLE});
|
||||||
|
Heal(MaxHealth/4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityDescription(Entity entity) {
|
||||||
|
return "Cast a spell to damage " + entity.Name + "and heal yourself. Your spell will pass enemy's defences";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||||
|
return "You cased the spell, enemy cannot do anything but to look at you with fear";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.project.item.Accessory;
|
||||||
|
|
||||||
|
import org.project.Interface.IAttachable;
|
||||||
|
import org.project.Interface.IDamageable;
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
import org.project.item.SellableItem;
|
||||||
|
|
||||||
|
public abstract class Accessory extends SellableItem implements IDamageable, IAttachable {
|
||||||
|
private int Health;
|
||||||
|
private final int MaxHealth;
|
||||||
|
|
||||||
|
public Accessory (String name, Entity owner, int price, int health, int maxHealth) {
|
||||||
|
super(name, owner, price);
|
||||||
|
this.Health = health;
|
||||||
|
this.MaxHealth = maxHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetHealth() {
|
||||||
|
return Health;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetMaxHealth() { return MaxHealth; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int GetPrice() {
|
||||||
|
int basePrice = super.GetPrice();
|
||||||
|
|
||||||
|
return basePrice * (Health/MaxHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void TakeDamage(int amount, AttackPowerUp[] powerUps) {
|
||||||
|
Health -= amount;
|
||||||
|
|
||||||
|
if (IsDestroyed()) {
|
||||||
|
HandleZeroHealth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean IsDestroyed() {
|
||||||
|
return Health < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void HandleZeroHealth() {
|
||||||
|
this.DeattachFrom(this.Owner, false);
|
||||||
|
this.Owner.Inventory.remove(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void AttachTo(Entity entity, boolean fromInventory);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void DeattachFrom(Entity entity, boolean toInventory);
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package org.project.item.Accessory;
|
||||||
|
|
||||||
|
import org.project.Interface.IDefender;
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class Costume extends Accessory implements IDefender {
|
||||||
|
private final int Defense;
|
||||||
|
|
||||||
|
public Costume(String name, Entity owner, int price, int health, int maxHealth, int defense) {
|
||||||
|
super(name, owner, price, health, maxHealth);
|
||||||
|
this.Defense = defense;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int GetDefense() {
|
||||||
|
return Defense;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int Apply(int damage, AttackPowerUp[] powerUps) {
|
||||||
|
if (Arrays.binarySearch(powerUps, AttackPowerUp.ANTI_CUSTOM) < 0) {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (damage <= Defense) {
|
||||||
|
this.TakeDamage(damage, null);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.TakeDamage(Defense, null);
|
||||||
|
return damage - Defense;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void AttachTo(Entity entity, boolean fromInventory) {
|
||||||
|
if (fromInventory) entity.RemoveFromInventory(this);
|
||||||
|
entity.Costume = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DeattachFrom(Entity entity, boolean toInventory) {
|
||||||
|
entity.Costume = null;
|
||||||
|
if (toInventory) entity.AddToInventory(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package org.project.item.Accessory;
|
||||||
|
|
||||||
|
import org.project.Interface.IDefender;
|
||||||
|
import org.project.constants.gameConstant.AttackPowerUp;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class Shield extends Accessory implements IDefender {
|
||||||
|
private final int Defense;
|
||||||
|
|
||||||
|
public Shield (String name, Entity owner, int price, int health, int maxHealth, int defense) {
|
||||||
|
super(name, owner, price, health, maxHealth);
|
||||||
|
this.Defense = defense;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int GetDefense() {
|
||||||
|
return Defense;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int Apply(int damage, AttackPowerUp[] powerUps) {
|
||||||
|
if (Arrays.binarySearch(powerUps, AttackPowerUp.ANTI_SHIELD) < 0) {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (damage <= Defense) {
|
||||||
|
this.TakeDamage(damage, null);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.TakeDamage(Defense, null);
|
||||||
|
return damage - Defense;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void AttachTo(Entity entity, boolean fromInventory) {
|
||||||
|
if (fromInventory) entity.RemoveFromInventory(this);
|
||||||
|
entity.Shield = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DeattachFrom(Entity entity, boolean toInventory) {
|
||||||
|
entity.Shield = null;
|
||||||
|
if (toInventory) entity.AddToInventory(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.project.item.Accessory;
|
||||||
|
|
||||||
|
import org.project.Interface.IDamageUtil;
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
public class Weapon extends Accessory implements IDamageUtil {
|
||||||
|
private final int Damage;
|
||||||
|
|
||||||
|
public Weapon (String name, Entity owner, int price, int health, int maxHealth, int damage) {
|
||||||
|
super(name, owner, price, health, maxHealth);
|
||||||
|
this.Damage = damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int GetDamage() {
|
||||||
|
return Damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void AttachTo(Entity entity, boolean fromInventory) {
|
||||||
|
if (fromInventory) entity.RemoveFromInventory(this);
|
||||||
|
entity.Weapon = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DeattachFrom(Entity entity, boolean toInventory) {
|
||||||
|
entity.Weapon = null;
|
||||||
|
if (toInventory) entity.AddToInventory(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,16 @@ package org.project.item;
|
|||||||
|
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
public interface Item {
|
public abstract class Item {
|
||||||
void use(Entity target);
|
private final String Name;
|
||||||
|
public Entity Owner;
|
||||||
|
|
||||||
/*
|
public Item (String name, Entity owner) {
|
||||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
this.Name = name;
|
||||||
*/
|
this.Owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.project.item;
|
||||||
|
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
public class KeyItem extends Item {
|
||||||
|
public KeyItem (String name, Entity owner) {
|
||||||
|
super(name, owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.project.item;
|
||||||
|
|
||||||
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
public class SellableItem extends Item{
|
||||||
|
private final int Price;
|
||||||
|
|
||||||
|
public SellableItem (String name, Entity owner, int price) {
|
||||||
|
super(name, owner);
|
||||||
|
this.Price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetPrice() {
|
||||||
|
return Price;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package org.project.item.armors;
|
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
|
||||||
public abstract class Armor {
|
|
||||||
private int defense;
|
|
||||||
private int maxDefense;
|
|
||||||
private int durability;
|
|
||||||
private int maxDurability;
|
|
||||||
|
|
||||||
private boolean isBroke;
|
|
||||||
|
|
||||||
public Armor(int defense, int durability) {
|
|
||||||
this.defense = defense;
|
|
||||||
this.durability = durability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkBreak() {
|
|
||||||
if (durability <= 0) {
|
|
||||||
isBroke = true;
|
|
||||||
defense = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: (BONUS) UPDATE THE REPAIR METHOD
|
|
||||||
public void repair() {
|
|
||||||
isBroke = false;
|
|
||||||
defense = maxDefense;
|
|
||||||
durability = maxDurability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDefense() {
|
|
||||||
return defense;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDurability() {
|
|
||||||
return durability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBroke() {
|
|
||||||
return isBroke;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package org.project.item.armors;
|
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
|
||||||
public class KnightArmor {
|
|
||||||
// TODO: DESIGN ARMOR'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package org.project.item.consumables;
|
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
|
||||||
public abstract class Consumable {
|
|
||||||
/*
|
|
||||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package org.project.item.consumables;
|
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
|
||||||
public class Flask {
|
|
||||||
/*
|
|
||||||
THIS IS AN EXAMPLE OF A CONSUMABLE DESIGN.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO: UPDATE USE METHOD
|
|
||||||
@Override
|
|
||||||
public void use(Entity target) {
|
|
||||||
target.heal(target.getMaxHP() / 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package org.project.item.weapons;
|
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
|
||||||
public class Sword {
|
|
||||||
/*
|
|
||||||
THIS IS AN EXAMPLE OF A WEAPON DESIGN.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int abilityCharge;
|
|
||||||
|
|
||||||
public Sword() {
|
|
||||||
// TODO: DESIGN SWORD'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: (BONUS) UPDATE THE UNIQUE ABILITY
|
|
||||||
public void uniqueAbility(ArrayList<Entity> targets) {
|
|
||||||
abilityCharge += 2;
|
|
||||||
for (Entity target : targets) {
|
|
||||||
target.takeDamage(getDamage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package org.project.item.weapons;
|
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
|
||||||
public abstract class Weapon {
|
|
||||||
private int damage;
|
|
||||||
private int manaCost;
|
|
||||||
|
|
||||||
/*
|
|
||||||
TODO: ADD OTHER REQUIRED AND BONUS ATTRIBUTES
|
|
||||||
*/
|
|
||||||
|
|
||||||
public Weapon(int damage, int manaCost) {
|
|
||||||
this.damage = damage;
|
|
||||||
this.manaCost = manaCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void use(Entity target) {
|
|
||||||
target.takeDamage(damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDamage() {
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getManaCost() {
|
|
||||||
return manaCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.project.location;
|
||||||
|
|
||||||
|
import org.project.entity.enemies.Dragon;
|
||||||
|
import org.project.entity.enemies.Enemy;
|
||||||
|
|
||||||
|
public class Castle extends Location {
|
||||||
|
public Castle() {
|
||||||
|
super("Castle");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Enemy GetEnemy() {
|
||||||
|
return new Dragon();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.project.location;
|
||||||
|
|
||||||
|
import org.project.entity.enemies.Enemy;
|
||||||
|
import org.project.entity.enemies.Vampire;
|
||||||
|
|
||||||
|
public class DarkCaves extends Location {
|
||||||
|
public DarkCaves() {
|
||||||
|
super("Dark Caves");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Enemy GetEnemy() {
|
||||||
|
return new Vampire();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.project.location;
|
||||||
|
|
||||||
|
import org.project.entity.enemies.Enemy;
|
||||||
|
import org.project.entity.enemies.Skeleton;
|
||||||
|
|
||||||
|
public class GraveYard extends Location {
|
||||||
|
public GraveYard() {
|
||||||
|
super("Grave Yard");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Enemy GetEnemy() {
|
||||||
|
return new Skeleton();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.project.location;
|
||||||
|
|
||||||
|
import org.project.entity.enemies.Enemy;
|
||||||
|
import org.project.entity.enemies.Goblin;
|
||||||
|
|
||||||
|
public class Jungle extends Location {
|
||||||
|
public Jungle() {
|
||||||
|
super("Jungle");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Enemy GetEnemy() {
|
||||||
|
return new Goblin();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,26 +3,30 @@ package org.project.location;
|
|||||||
import org.project.entity.enemies.Enemy;
|
import org.project.entity.enemies.Enemy;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class Location {
|
public abstract class Location {
|
||||||
private String name;
|
private final String name;
|
||||||
|
public Enemy enemy;
|
||||||
|
|
||||||
private ArrayList<Enemy> enemies;
|
public Location(String name) {
|
||||||
|
this.name = name;
|
||||||
public Location(ArrayList<Location> locations, ArrayList<Enemy> enemies) {
|
this.enemy = GetEnemy();
|
||||||
this.locations = locations;
|
|
||||||
this.enemies = enemies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() { return name; }
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<Location> getLocations() {
|
protected abstract Enemy GetEnemy();
|
||||||
return locations;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<Enemy> getEnemies() {
|
public static Location RandomLocation() {
|
||||||
return enemies;
|
Random random = new Random();
|
||||||
|
int chance = random.nextInt(3);
|
||||||
|
|
||||||
|
return switch (chance) {
|
||||||
|
case 0 -> new GraveYard();
|
||||||
|
case 1 -> new DarkCaves();
|
||||||
|
case 2 -> new Jungle();
|
||||||
|
default -> new Jungle();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package org.project.util;
|
||||||
|
|
||||||
|
import org.project.Interface.IDamageUtil;
|
||||||
|
import org.project.Interface.IDefender;
|
||||||
|
import org.project.constants.appConstants.TextColor;
|
||||||
|
import org.project.item.Accessory.Accessory;
|
||||||
|
import org.project.item.Item;
|
||||||
|
import org.project.item.KeyItem;
|
||||||
|
import org.project.item.SellableItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Dictionary;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
|
||||||
|
public class DisplayItem {
|
||||||
|
public static void DisplayItems(ArrayList<Item> items) {
|
||||||
|
for (Item item : items) {
|
||||||
|
if (item == null) continue;
|
||||||
|
|
||||||
|
String result = item.getName();
|
||||||
|
|
||||||
|
if (item instanceof SellableItem) {
|
||||||
|
result += "\n Price = " + ((SellableItem) item).GetPrice();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item instanceof Accessory) {
|
||||||
|
result += "\n Health = " + ((Accessory) item).GetHealth() + "/" + ((Accessory) item).GetMaxHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item instanceof IDamageUtil) {
|
||||||
|
result += "\n Damage = " + ((IDamageUtil) item).GetDamage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item instanceof IDefender) {
|
||||||
|
result += "\n Defence = " + ((IDefender) item).GetDefense();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Dictionary<Integer, Item> MenuDisplay(ArrayList<Item> items) {
|
||||||
|
int index = 0;
|
||||||
|
Dictionary<Integer, Item> dictionary = new Hashtable<>();
|
||||||
|
|
||||||
|
for (Item item : items) {
|
||||||
|
if (item == null) continue;
|
||||||
|
|
||||||
|
String result = index + " > " + item.getName();
|
||||||
|
|
||||||
|
if (item instanceof KeyItem) {
|
||||||
|
result += TextColor.Yellow + " (KEY ITEM)" + TextColor.Reset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item instanceof SellableItem) {
|
||||||
|
result += "\n Price = " + ((SellableItem) item).GetPrice();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item instanceof Accessory) {
|
||||||
|
result += "\n Health = " + ((Accessory) item).GetHealth() + "/" + ((Accessory) item).GetMaxHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item instanceof IDamageUtil) {
|
||||||
|
result += "\n Damage = " + ((IDamageUtil) item).GetDamage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item instanceof IDefender) {
|
||||||
|
result += "\n Defence = " + ((IDefender) item).GetDefense();
|
||||||
|
}
|
||||||
|
|
||||||
|
dictionary.put(index, item);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dictionary;
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 67 KiB |
Reference in New Issue
Block a user