Skip to content

Commit

Permalink
pack map
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarpunk committed Dec 10, 2024
1 parent 8a9a9e8 commit df90d8f
Show file tree
Hide file tree
Showing 97 changed files with 807 additions and 31 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/Writerside/resources/Geometry/
/Writerside/resources/System Volume Information/
8 changes: 6 additions & 2 deletions .idea/Moonlight.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Moonlight

Карта для WarCraft 3 в жанре roguelike служащая в основном для демонстрации возможностей UjAPI и AngelScript.

Документация и всякое интересное о карте находится [здесь](https://warraft.github.io/Moonlight/about.html).
6 changes: 5 additions & 1 deletion Writerside/Moonlight.tree
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

<toc-element topic="about.md"/>
<toc-element topic="tech.md"/>
<toc-element topic="ui.md"/>
<toc-element topic="ui.md">
<toc-element topic="font.md"/>
</toc-element>
<toc-element topic="tileset.md"/>
<toc-element topic="DNC.md"/>
<toc-element topic="credits.md"/>
<toc-element topic="donate.md"/>
</instance-profile>
127 changes: 127 additions & 0 deletions Writerside/resources/as/test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
float missileTick = .01f;
table missileTable = {};

float lerp(float a, float b, float t) {
return a*(1-t)+b*t;
}

void missileCallback() {
timer t = GetExpiredTimer();
uint index = GetHandleId(t);
//auto @m = cast<Missile>(missileTable[index]);
if (!m.tick()) return;
missileTable.delete(index);
}


class Missile {

Missile(SpellEffectEvent@ spellEffectEvent) {
auto @evt = @this.spellEffectEvent = @spellEffectEvent;
auto @s = @evt.casterPoint;
s.z += 100;
auto @e = @evt.targetPoint;
e.z += 50;


specialEffect = AddSpecialEffect("Missile\\ShockBlast_Green.mdx", s.x, s.y);
SetSpecialEffectZ(specialEffect, s.z);

auto dp = evt.targetPoint - evt.casterPoint;
distance = SquareRoot(dp.x * dp.x + dp.y * dp.y);
time = distance / speed;

timer t = CreateTimer();

missileTable.set(GetHandleId(t), @this);
TimerStart(t, missileTick, true, @missileCallback);
}

bool tick() {
bool complete = false;
float t = elapsed / time;
if (t >= 1.f) {
t = 1.f;
complete = true;
}

auto @evt = @spellEffectEvent;
auto @s = evt.casterPoint;
auto @e = evt.targetPoint;

SetSpecialEffectPositionWithZ(specialEffect,
lerp(s.x, e.x, t),
lerp(s.y, e.y, t),
lerp(s.z, e.z, t)
);

if (complete) {
DestroyEffect(specialEffect);
}

elapsed+=missileTick;
return complete;
}

float elapsed = 0.f;
float speed = 500.f;
float time;
float distance;
effect specialEffect;
SpellEffectEvent@ spellEffectEvent;
}

class Point {
Point() {
x = 0.f;
y = 0.f;
z = 0.f;
}

Point(float x, float y, float z = 0.f) {
this.x = x;
this.y = y;
this.z = z;
}

Point(unit u) {
x = GetUnitX(u);
y = GetUnitY(u);
z = GetUnitZ(u);
}

Point opSub(Point b) {
return Point(x - b.x, y - b.y, z - b.z);
}

float x;
float y;
float z;
}

class SpellEffectEvent {
SpellEffectEvent() {
caster = GetTriggerUnit();
casterPoint = Point(caster);

float tx = GetSpellTargetX();
float ty = GetSpellTargetY();
targetPoint = Point(tx, ty, GetAxisZ(tx, ty));
}

unit caster;
Point casterPoint;
Point targetPoint;
}

void main() {
TimerStart(CreateTimer(), 0.f, false, function() {
DestroyTimer(GetExpiredTimer());



});
}

void config() {
}
17 changes: 14 additions & 3 deletions Writerside/resources/as/war3map.as
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
void main(){
print("work");
}
void main() {
print("start");

for (int i = 0; i < 12 ; ++i) {
player p = Player(i);
TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_SPELL_EFFECT, nil);
if (GetPlayerController(p) == MAP_CONTROL_USER && GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING) {
unit u = CreateUnit(p, 'Hjai', 0, 0, 0);
SelectUnit(u, true);
AddSpecialEffectTarget("Attachment\\Attach\\CosmicElvenWings\\Void\\Void.mdx", u, "chest");
AddSpecialEffectTarget("Attachment\\Torch.mdx", u, "hand left");
}
}
}
Loading

0 comments on commit df90d8f

Please sign in to comment.