Version 2.0.0 #35

Merged
mike merged 19 commits from develop into main 2023-10-02 01:51:47 +00:00
29 changed files with 342 additions and 86 deletions
Showing only changes of commit 8750378977 - Show all commits

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000028 MANIFEST-000138

View File

@ -1,8 +1,8 @@
2023/09/20-18:33:11.649325 7f35b1afa640 Recovering log #26 2023/09/25-22:33:46.979390 7fe7b968d700 Recovering log #135
2023/09/20-18:33:11.651970 7f35b1afa640 Delete type=0 #26 2023/09/25-22:33:46.999374 7fe7b968d700 Delete type=3 #133
2023/09/20-18:33:11.651984 7f35b1afa640 Delete type=3 #24 2023/09/25-22:33:46.999397 7fe7b968d700 Delete type=0 #135
2023/09/20-18:35:02.787239 7f35aac16640 Level-0 table #31: started 2023/09/25-22:34:49.573980 7fe51bfff700 Level-0 table #141: started
2023/09/20-18:35:02.787256 7f35aac16640 Level-0 table #31: 0 bytes OK 2023/09/25-22:34:49.573997 7fe51bfff700 Level-0 table #141: 0 bytes OK
2023/09/20-18:35:02.788228 7f35aac16640 Delete type=0 #29 2023/09/25-22:34:49.583422 7fe51bfff700 Delete type=0 #139
2023/09/20-18:35:02.790809 7f35aac16640 Manual compaction at level-0 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at (end) 2023/09/25-22:34:49.602253 7fe51bfff700 Manual compaction at level-0 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at (end)
2023/09/20-18:35:02.790825 7f35aac16640 Manual compaction at level-1 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at (end) 2023/09/25-22:34:49.611494 7fe51bfff700 Manual compaction at level-1 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at (end)

View File

@ -1,8 +1,15 @@
2023/09/20-18:32:47.289541 7f35abfff640 Recovering log #22 2023/09/24-17:51:32.119358 7fe7b9e8e700 Recovering log #132
2023/09/20-18:32:47.292747 7f35abfff640 Delete type=3 #20 2023/09/24-17:51:32.127144 7fe7b9e8e700 Delete type=3 #131
2023/09/20-18:32:47.292767 7f35abfff640 Delete type=0 #22 2023/09/24-17:51:32.127174 7fe7b9e8e700 Delete type=0 #132
2023/09/20-18:32:55.178475 7f35aac16640 Level-0 table #27: started 2023/09/25-22:27:28.458282 7fe51bfff700 Level-0 table #136: started
2023/09/20-18:32:55.178505 7f35aac16640 Level-0 table #27: 0 bytes OK 2023/09/25-22:27:28.461383 7fe51bfff700 Level-0 table #136: 5360 bytes OK
2023/09/20-18:32:55.179492 7f35aac16640 Delete type=0 #25 2023/09/25-22:27:28.464487 7fe51bfff700 Delete type=0 #134
2023/09/20-18:32:55.179677 7f35aac16640 Manual compaction at level-0 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at (end) 2023/09/25-22:27:28.468877 7fe51bfff700 Manual compaction at level-0 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at (end)
2023/09/20-18:32:55.181986 7f35aac16640 Manual compaction at level-1 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at (end) 2023/09/25-22:27:28.468974 7fe51bfff700 Manual compaction at level-1 from '!folders!0nDRFmMBs5DBJU9M' @ 72057594037927935 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at '!items!vdYpJXIMdqUi7IDh' @ 170 : 1
2023/09/25-22:27:28.468980 7fe51bfff700 Compacting 1@1 + 1@2 files
2023/09/25-22:27:28.471549 7fe51bfff700 Generated table #137@1: 17 keys, 8737 bytes
2023/09/25-22:27:28.471557 7fe51bfff700 Compacted 1@1 + 1@2 files => 8737 bytes
2023/09/25-22:27:28.474310 7fe51bfff700 compacted to: files[ 0 0 1 0 0 0 0 ]
2023/09/25-22:27:28.474351 7fe51bfff700 Delete type=2 #136
2023/09/25-22:27:28.474385 7fe51bfff700 Delete type=2 #130
2023/09/25-22:27:28.482548 7fe51bfff700 Manual compaction at level-1 from '!items!vdYpJXIMdqUi7IDh' @ 170 : 1 .. '!items!xA7qKMmugJv7z6j1' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000014 MANIFEST-000040

View File

@ -1,8 +1,8 @@
2023/09/20-18:33:11.652467 7f35b1afa640 Recovering log #12 2023/09/25-22:33:47.001326 7fe7b9e8e700 Recovering log #38
2023/09/20-18:33:11.655548 7f35b1afa640 Delete type=3 #10 2023/09/25-22:33:47.021271 7fe7b9e8e700 Delete type=0 #38
2023/09/20-18:33:11.655561 7f35b1afa640 Delete type=0 #12 2023/09/25-22:33:47.021294 7fe7b9e8e700 Delete type=3 #36
2023/09/20-18:35:02.789988 7f35aac16640 Level-0 table #17: started 2023/09/25-22:34:49.621185 7fe51bfff700 Level-0 table #43: started
2023/09/20-18:35:02.789998 7f35aac16640 Level-0 table #17: 0 bytes OK 2023/09/25-22:34:49.621202 7fe51bfff700 Level-0 table #43: 0 bytes OK
2023/09/20-18:35:02.790789 7f35aac16640 Delete type=0 #15 2023/09/25-22:34:49.630680 7fe51bfff700 Delete type=0 #41
2023/09/20-18:35:02.791851 7f35aac16640 Manual compaction at level-0 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end) 2023/09/25-22:34:49.650161 7fe51bfff700 Manual compaction at level-0 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end)
2023/09/20-18:35:02.793928 7f35aac16640 Manual compaction at level-1 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end) 2023/09/25-22:34:49.659391 7fe51bfff700 Manual compaction at level-1 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end)

View File

@ -1,8 +1,8 @@
2023/09/20-18:32:47.293080 7f35abfff640 Recovering log #8 2023/09/24-17:51:32.129349 7fe7ba68f700 Recovering log #35
2023/09/20-18:32:47.295939 7f35abfff640 Delete type=3 #6 2023/09/24-17:51:32.137024 7fe7ba68f700 Delete type=0 #35
2023/09/20-18:32:47.295950 7f35abfff640 Delete type=0 #8 2023/09/24-17:51:32.137042 7fe7ba68f700 Delete type=3 #34
2023/09/20-18:32:55.179689 7f35aac16640 Level-0 table #13: started 2023/09/25-22:27:28.464580 7fe51bfff700 Level-0 table #39: started
2023/09/20-18:32:55.179702 7f35aac16640 Level-0 table #13: 0 bytes OK 2023/09/25-22:27:28.464601 7fe51bfff700 Level-0 table #39: 0 bytes OK
2023/09/20-18:32:55.180872 7f35aac16640 Delete type=0 #11 2023/09/25-22:27:28.468758 7fe51bfff700 Delete type=0 #37
2023/09/20-18:32:55.182876 7f35aac16640 Manual compaction at level-0 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end) 2023/09/25-22:27:28.468891 7fe51bfff700 Manual compaction at level-0 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end)
2023/09/20-18:32:55.183765 7f35aac16640 Manual compaction at level-1 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end) 2023/09/25-22:27:28.482519 7fe51bfff700 Manual compaction at level-1 from '!actors!U5v4gFHquo0Y1SAq' @ 72057594037927935 : 1 .. '!actors!U5v4gFHquo0Y1SAq' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000141 MANIFEST-000168

View File

@ -1,8 +1,8 @@
2023/09/20-18:33:11.648902 7f35b12f9640 Recovering log #139 2023/09/25-22:33:46.957940 7fe7b9e8e700 Recovering log #165
2023/09/20-18:33:11.651508 7f35b12f9640 Delete type=3 #137 2023/09/25-22:33:46.977376 7fe7b9e8e700 Delete type=0 #165
2023/09/20-18:33:11.651529 7f35b12f9640 Delete type=0 #139 2023/09/25-22:33:46.977395 7fe7b9e8e700 Delete type=3 #163
2023/09/20-18:35:02.786339 7f35aac16640 Level-0 table #144: started 2023/09/25-22:34:49.583492 7fe51bfff700 Level-0 table #171: started
2023/09/20-18:35:02.786350 7f35aac16640 Level-0 table #144: 0 bytes OK 2023/09/25-22:34:49.583508 7fe51bfff700 Level-0 table #171: 0 bytes OK
2023/09/20-18:35:02.787177 7f35aac16640 Delete type=0 #142 2023/09/25-22:34:49.592987 7fe51bfff700 Delete type=0 #169
2023/09/20-18:35:02.787211 7f35aac16640 Manual compaction at level-0 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end) 2023/09/25-22:34:49.611444 7fe51bfff700 Manual compaction at level-0 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end)
2023/09/20-18:35:02.787227 7f35aac16640 Manual compaction at level-1 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end) 2023/09/25-22:34:49.611542 7fe51bfff700 Manual compaction at level-1 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end)

View File

@ -1,8 +1,15 @@
2023/09/20-18:32:47.289270 7f35b12f9640 Recovering log #135 2023/09/24-17:51:32.110592 7fe7ba68f700 Recovering log #162
2023/09/20-18:32:47.292331 7f35b12f9640 Delete type=0 #135 2023/09/24-17:51:32.118170 7fe7ba68f700 Delete type=3 #161
2023/09/20-18:32:47.292340 7f35b12f9640 Delete type=3 #133 2023/09/24-17:51:32.118190 7fe7ba68f700 Delete type=0 #162
2023/09/20-18:32:55.177108 7f35aac16640 Level-0 table #140: started 2023/09/25-22:27:28.431163 7fe51bfff700 Level-0 table #166: started
2023/09/20-18:32:55.177118 7f35aac16640 Level-0 table #140: 0 bytes OK 2023/09/25-22:27:28.433469 7fe51bfff700 Level-0 table #166: 724 bytes OK
2023/09/20-18:32:55.178381 7f35aac16640 Delete type=0 #138 2023/09/25-22:27:28.436317 7fe51bfff700 Delete type=0 #164
2023/09/20-18:32:55.179534 7f35aac16640 Manual compaction at level-0 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end) 2023/09/25-22:27:28.445034 7fe51bfff700 Manual compaction at level-0 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end)
2023/09/20-18:32:55.179687 7f35aac16640 Manual compaction at level-1 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end) 2023/09/25-22:27:28.445112 7fe51bfff700 Manual compaction at level-1 from '!folders!hIbrWxg1nDutCSwt' @ 72057594037927935 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at '!macros!8gxeYSUJ1FQhmJRw' @ 37 : 1
2023/09/25-22:27:28.445116 7fe51bfff700 Compacting 1@1 + 1@2 files
2023/09/25-22:27:28.449145 7fe51bfff700 Generated table #167@1: 19 keys, 4653 bytes
2023/09/25-22:27:28.449155 7fe51bfff700 Compacted 1@1 + 1@2 files => 4653 bytes
2023/09/25-22:27:28.452097 7fe51bfff700 compacted to: files[ 0 0 1 0 0 0 0 ]
2023/09/25-22:27:28.452136 7fe51bfff700 Delete type=2 #128
2023/09/25-22:27:28.452197 7fe51bfff700 Delete type=2 #166
2023/09/25-22:27:28.468818 7fe51bfff700 Manual compaction at level-1 from '!macros!8gxeYSUJ1FQhmJRw' @ 37 : 1 .. '!macros!wU2mAUnw3RW9qMT8' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000141 MANIFEST-000168

View File

@ -1,8 +1,8 @@
2023/09/20-18:33:11.644631 7f35b12f9640 Recovering log #139 2023/09/25-22:33:46.936754 7fe7b968d700 Recovering log #165
2023/09/20-18:33:11.647218 7f35b12f9640 Delete type=3 #137 2023/09/25-22:33:46.956358 7fe7b968d700 Delete type=0 #165
2023/09/20-18:33:11.647235 7f35b12f9640 Delete type=0 #139 2023/09/25-22:33:46.956379 7fe7b968d700 Delete type=3 #163
2023/09/20-18:35:02.785518 7f35aac16640 Level-0 table #144: started 2023/09/25-22:34:49.564751 7fe51bfff700 Level-0 table #171: started
2023/09/20-18:35:02.785531 7f35aac16640 Level-0 table #144: 0 bytes OK 2023/09/25-22:34:49.564770 7fe51bfff700 Level-0 table #171: 0 bytes OK
2023/09/20-18:35:02.786320 7f35aac16640 Delete type=0 #142 2023/09/25-22:34:49.573732 7fe51bfff700 Delete type=0 #169
2023/09/20-18:35:02.787206 7f35aac16640 Manual compaction at level-0 from '!journal!Mw1g2Fx5dp4SoqVP' @ 72057594037927935 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.i31qmsZnIGhjvA2K' @ 0 : 0; will stop at (end) 2023/09/25-22:34:49.573869 7fe51bfff700 Manual compaction at level-0 from '!journal!HbtPlHNFO1L6RVj0' @ 72057594037927935 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.lhULHNp4gz9IjOR3' @ 0 : 0; will stop at (end)
2023/09/20-18:35:02.787222 7f35aac16640 Manual compaction at level-1 from '!journal!Mw1g2Fx5dp4SoqVP' @ 72057594037927935 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.i31qmsZnIGhjvA2K' @ 0 : 0; will stop at (end) 2023/09/25-22:34:49.583466 7fe51bfff700 Manual compaction at level-1 from '!journal!HbtPlHNFO1L6RVj0' @ 72057594037927935 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.lhULHNp4gz9IjOR3' @ 0 : 0; will stop at (end)

View File

@ -1,8 +1,15 @@
2023/09/20-18:32:47.285951 7f35abfff640 Recovering log #135 2023/09/24-17:51:32.100602 7fe7b9e8e700 Recovering log #162
2023/09/20-18:32:47.288584 7f35abfff640 Delete type=0 #135 2023/09/24-17:51:32.108259 7fe7b9e8e700 Delete type=3 #161
2023/09/20-18:32:47.288602 7f35abfff640 Delete type=3 #133 2023/09/24-17:51:32.108296 7fe7b9e8e700 Delete type=0 #162
2023/09/20-18:32:55.176080 7f35aac16640 Level-0 table #140: started 2023/09/25-22:27:28.439755 7fe51bfff700 Level-0 table #166: started
2023/09/20-18:32:55.176086 7f35aac16640 Level-0 table #140: 0 bytes OK 2023/09/25-22:27:28.442121 7fe51bfff700 Level-0 table #166: 10961 bytes OK
2023/09/20-18:32:55.177093 7f35aac16640 Delete type=0 #138 2023/09/25-22:27:28.444862 7fe51bfff700 Delete type=0 #164
2023/09/20-18:32:55.179521 7f35aac16640 Manual compaction at level-0 from '!journal!Mw1g2Fx5dp4SoqVP' @ 72057594037927935 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.i31qmsZnIGhjvA2K' @ 0 : 0; will stop at (end) 2023/09/25-22:27:28.445099 7fe51bfff700 Manual compaction at level-0 from '!journal!HbtPlHNFO1L6RVj0' @ 72057594037927935 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.lhULHNp4gz9IjOR3' @ 0 : 0; will stop at (end)
2023/09/20-18:32:55.179551 7f35aac16640 Manual compaction at level-1 from '!journal!Mw1g2Fx5dp4SoqVP' @ 72057594037927935 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.i31qmsZnIGhjvA2K' @ 0 : 0; will stop at (end) 2023/09/25-22:27:28.452245 7fe51bfff700 Manual compaction at level-1 from '!journal!HbtPlHNFO1L6RVj0' @ 72057594037927935 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.lhULHNp4gz9IjOR3' @ 0 : 0; will stop at '!journal.pages!Mw1g2Fx5dp4SoqVP.lhULHNp4gz9IjOR3' @ 63 : 1
2023/09/25-22:27:28.452253 7fe51bfff700 Compacting 1@1 + 1@2 files
2023/09/25-22:27:28.455468 7fe51bfff700 Generated table #167@1: 7 keys, 4142 bytes
2023/09/25-22:27:28.455475 7fe51bfff700 Compacted 1@1 + 1@2 files => 4142 bytes
2023/09/25-22:27:28.458177 7fe51bfff700 compacted to: files[ 0 0 1 0 0 0 0 ]
2023/09/25-22:27:28.458213 7fe51bfff700 Delete type=2 #166
2023/09/25-22:27:28.458245 7fe51bfff700 Delete type=2 #96
2023/09/25-22:27:28.468848 7fe51bfff700 Manual compaction at level-1 from '!journal.pages!Mw1g2Fx5dp4SoqVP.lhULHNp4gz9IjOR3' @ 63 : 1 .. '!journal.pages!Mw1g2Fx5dp4SoqVP.lhULHNp4gz9IjOR3' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,5 @@
import { api } from './api.js' import { api } from './api.js'
import { shapeChangeOnDismiss } from './powerEffects.js'
import { log } from './shim.js' import { log } from './shim.js'
function _checkModule (name) { function _checkModule (name) {
@ -15,4 +16,5 @@ Hooks.on('setup', api.registerFunctions)
Hooks.on('ready', () => { Hooks.on('ready', () => {
_checkModule('warpgate') _checkModule('warpgate')
log('Initialized SWADE MB Helpers') log('Initialized SWADE MB Helpers')
warpgate.event.watch(warpgate.EVENT.DISMISS, shapeChangeOnDismiss)
}) })

View File

@ -541,6 +541,205 @@ class ProtectionEffect extends TargetedPowerEffect {
} }
} }
class ShapeChangeEffect extends TargetedPowerEffect {
get actorFolderBase () {
return 'Morphables'
}
get tempActorFolder () {
return `${this.actorFolderBase}/Changed`
}
get actorFolder () {
return `${this.actorFolderBase}/${this.name}`
}
get name () {
return 'Shape Change'
}
get baseDurationRounds () {
if (this.increasedDuration ?? false) {
return 50
}
return 5
}
async prepFolders () {
const folders = []
const folderNames = [
this.actorFolder,
`${this.actorFolder} - Default`,
`${this.actorFolder}/Default`,
`${this.actorFolder} - ${this.token.name}`,
`${this.actorFolder} - ${this.token.actor.name}`,
`${this.actorFolder}/${this.token.name}`,
`${this.actorFolder}/${this.token.actor.name}`
]
for (const folderName of folderNames) {
const folder = shim.getActorFolderByPath(folderName)
if (folder) {
log(`Found actor folder ${folderName}`)
folders.push(folder)
}
}
if (folders.length > 1) {
folders.shift()
}
return folders
}
async prepActors () {
const folders = await this.prepFolders()
const actors = {}
for (const folder of folders) {
const folderActors = shim.getActorsInFolder(folder)
for (const key in folderActors) {
actors[key] = folderActors[key]
}
}
return actors
}
async prepMenu () {
const actors = await this.prepActors()
this.cancel = false
if (Object.keys(actors).length < 1) {
shim.notifications.error('No summonables found')
this.cancel = true
}
function actorData (key) {
return {
value: actors[key].id,
html: key
}
}
this.summonableActors = actors
this.menuData.inputs = this.menuData.inputs.concat([
{
type: 'select',
label: 'Turn into creature',
options: Object.keys(actors).filter(
k => !k.includes('_template')).sort().map(actorData)
}, {
type: 'checkbox',
label: 'Duration (+1, rounds to minutes)',
options: false
}
])
}
async prepResult () {
this.raise = (this.buttons === 'raise')
this.actorId = (this.inputs[this.inputIndex])
this.increasedDuration = (!!this.inputs[this.inputIndex + 1])
this.actor = shim.actors.get(this.actorId)
this.icon = this.targets[0].document.texture.src
const targetActor = this.targets[0].actor
this.protoDoc = await this.actor.getTokenDocument()
this.spawnOptions = {
controllingActor: this.targets[0].actor,
duplicates: 1,
updateOpts: {
embedded: {
Item: {
renderSheet: null
}
}
},
crosshairs: {
rememberControlled: true
}
}
const effectChanges = []
if (this.raise) {
for (const stat of ['vigor', 'strength']) {
effectChanges.push({
key: `system.attributes.${stat}.die.sides`,
mode: CONST.FOUNDRY.ACTIVE_EFFECT_MODES.ADD,
value: '+2',
priority: 0
})
}
}
this.effectDocs.push(
shim.createEffectDocument(
this.icon,
`Shape Change into ${this.protoDoc.name}`,
this.durationRounds, effectChanges)
)
this.spawnMutation = {
actor: {
name: `${this.targets[0].actor.name} (${this.actor.name} form)`,
system: {
attributes: {
smarts: { die: targetActor.system.attributes.smarts.die },
spirit: { die: targetActor.system.attributes.spirit.die }
},
wildcard: targetActor.system.wildcard
}
},
token: {
flags: {
'swade-mb-helpers.shapeChange.srcTokenId': this.targets[0].id
},
actorLink: false,
name: `${this.targets[0].name} (${this.protoDoc.name} form) `,
elevation: this.targets[0].document.elevation,
disposition: this.targets[0].document.disposition
},
embedded: { ActiveEffect: {}, Item: {} }
}
for (const doc of this.effectDocs) {
this.spawnMutation.embedded.ActiveEffect[doc.name] = doc
}
for (const doc of this.targets[0].actor.effects) {
this.spawnMutation.embedded.ActiveEffect[doc.name] = this.targets[0].actor.getEmbeddedDocument('ActiveEffect', doc.id)
}
for (const item of targetActor.items) {
if (item.type === 'skill' && ['smarts', 'spirit'].includes(item.system.attribute)) {
const doc = await this.targets[0].actor.getEmbeddedDocument('Item', item.id)
this.spawnMutation.embedded.Item[item.name] = doc
}
if (['power', 'edge', 'hindrance', 'action'].includes(item.type)) {
const doc = await this.targets[0].actor.getEmbeddedDocument('Item', item.id)
this.spawnMutation.embedded.Item[item.name] = doc
}
}
}
async applyResult () {
log('protoDoc', this.protoDoc)
log('spawnOptions', this.spawnOptions)
log('spawnMutation', this.spawnMutation)
const newTokenId = (await shim.warpgateSpawnAt(
this.targets[0].center,
this.protoDoc,
this.spawnMutation,
{},
this.spawnOptions
))[0]
await this.targets[0].document.setFlag('swade-mb-helpers', 'shapeChange', {
toId: newTokenId,
saved: {
alpha: this.targets[0].document.alpha,
hidden: this.targets[0].document.hidden,
x: this.targets[0].document.x,
y: this.targets[0].document.y,
elevation: this.targets[0].document.elevation
}
})
await this.targets[0].document.update({
hidden: true,
alpha: 0.05
})
}
}
class SmiteEffect extends TargetedPowerEffect { class SmiteEffect extends TargetedPowerEffect {
get name () { get name () {
return 'Smite' return 'Smite'
@ -577,20 +776,15 @@ class SmiteEffect extends TargetedPowerEffect {
const raise = (this.buttons === 'raise') const raise = (this.buttons === 'raise')
const greater = !!this.inputs[this.inputIndex] const greater = !!this.inputs[this.inputIndex]
const changeValue = (greater ? (raise ? '+6' : '+4') : (raise ? '+4' : '+2')) const changeValue = (greater ? (raise ? '+6' : '+4') : (raise ? '+4' : '+2'))
const changeKey = 'system.stats.globalMods.damage'
for (const token of this.targets) { for (const token of this.targets) {
const weaponName = this.inputs[this.tokenWeapons[token.id]] const weaponName = this.inputs[this.tokenWeapons[token.id]]
const weaponId = token.actor.items.getName(weaponName)?.id const effectName = `Smite (${weaponName})`
const changeKey = `@Weapon{${weaponName}}[system.actions.dmgMod]`
if (!weaponId) {
continue
}
const effectName = `${this.buttons === 'raise' ? 'major' : 'minor'} Smite${greater ? ' (greater)' : ''} (${weaponName})`
const changes = [ const changes = [
{ key: changeKey, mode, value: changeValue, priority: 0 } { key: changeKey, mode, value: changeValue, priority: 0 }
] ]
this.baseEffect.changes = changes this.baseEffect.changes = changes
this.baseEffect.name = effectName this.baseEffect.name = effectName
console.log(token, weaponName, weaponId, effectName, changeKey)
await shim.applyActiveEffects(token, [this.baseEffect].concat(this.effectDocs)) await shim.applyActiveEffects(token, [this.baseEffect].concat(this.effectDocs))
} }
} }
@ -698,6 +892,13 @@ class SummonEffect extends PowerEffect {
this.spawnOptions = { this.spawnOptions = {
controllingActor: this.token.actor, controllingActor: this.token.actor,
duplicates: this.number, duplicates: this.number,
updateOpts: {
embedded: {
Item: {
renderSheet: null
}
}
},
crosshairs: { crosshairs: {
icon: this.icon, icon: this.icon,
label: `Summon ${this.actor.name}`, label: `Summon ${this.actor.name}`,
@ -788,6 +989,9 @@ class SummonEffect extends PowerEffect {
async applyResult () { async applyResult () {
await this.prepAdditional() await this.prepAdditional()
log('protoDoc', this.protoDoc)
log('spawnOptions', this.spawnOptions)
log('spawnMutation', this.spawnMutation)
await shim.warpgateSpawn(this.protoDoc, this.spawnMutation, {}, this.spawnOptions) await shim.warpgateSpawn(this.protoDoc, this.spawnMutation, {}, this.spawnOptions)
} }
} }
@ -870,7 +1074,7 @@ class SummonAllyEffect extends SummonEffect {
} }
const edge = template.items.getName(inputs[i]) const edge = template.items.getName(inputs[i])
if (edge) { if (edge) {
const doc = template.getEmbeddedDocument('Item', edge.id) const doc = await template.getEmbeddedDocument('Item', edge.id)
this.spawnMutation.embedded.Item[edge.name] = doc this.spawnMutation.embedded.Item[edge.name] = doc
} }
} }
@ -884,7 +1088,6 @@ class SummonAllyEffect extends SummonEffect {
for (const item of template.items) { for (const item of template.items) {
const doc = await template.getEmbeddedDocument('Item', item.id) const doc = await template.getEmbeddedDocument('Item', item.id)
this.spawnMutation.embedded.Item[item.name] = doc this.spawnMutation.embedded.Item[item.name] = doc
log(`Added ${item.name} to spawn mutation`)
} }
} }
@ -896,12 +1099,10 @@ class SummonAllyEffect extends SummonEffect {
for (const item of template.items) { for (const item of template.items) {
const doc = await template.getEmbeddedDocument('Item', item.id) const doc = await template.getEmbeddedDocument('Item', item.id)
this.spawnMutation.embedded.Item[item.name] = doc this.spawnMutation.embedded.Item[item.name] = doc
log(`Added ${item.name} to spawn mutation`)
} }
for (const effect of template.effects.values()) { for (const effect of template.effects.values()) {
const doc = shim.ActiveEffect.fromSource(effect) const doc = shim.ActiveEffect.fromSource(effect)
this.spawnMutation.embedded.ActiveEffect[effect.name] = doc this.spawnMutation.embedded.ActiveEffect[effect.name] = doc
log(`Added ${effect.name} to spawn mutation`)
} }
} }
@ -936,7 +1137,7 @@ class SummonAllyEffect extends SummonEffect {
this.spawnOptions.crosshairs.icon = this.icon this.spawnOptions.crosshairs.icon = this.icon
for (const mirrorItem of mirrorActor.items) { for (const mirrorItem of mirrorActor.items) {
this.spawnMutation.embedded.Item[mirrorItem.name] = this.spawnMutation.embedded.Item[mirrorItem.name] =
mirrorActor.getEmbeddedDocument('Item', mirrorItem.id) await mirrorActor.getEmbeddedDocument('Item', mirrorItem.id)
} }
this.spawnMutation.embedded.Item['Summon Ally'] = CONST.WARPGATE.DELETE this.spawnMutation.embedded.Item['Summon Ally'] = CONST.WARPGATE.DELETE
const effectChanges = [] const effectChanges = []
@ -999,13 +1200,15 @@ const PowerClasses = {
invisibility: InvisibilityEffect, invisibility: InvisibilityEffect,
'lower trait': BoostLowerTraitEffect, 'lower trait': BoostLowerTraitEffect,
protection: ProtectionEffect, protection: ProtectionEffect,
'shape change': ShapeChangeEffect,
smite: SmiteEffect, smite: SmiteEffect,
'summon ally': SummonAllyEffect, 'summon ally': SummonAllyEffect,
'summon animal': SummonAnimalEffect, 'summon animal': SummonAnimalEffect,
'summon monster': SummonMonsterEffect, 'summon monster': SummonMonsterEffect,
"summon nature's ally": SummonNaturesAllyEffect, "summon nature's ally": SummonNaturesAllyEffect,
'summon planar ally': SummonPlanarAllyEffect, 'summon planar ally': SummonPlanarAllyEffect,
'summon undead': SummonUndeadEffect 'summon undead': SummonUndeadEffect,
zombie: SummonUndeadEffect
} }
export async function powerEffects (options = {}) { export async function powerEffects (options = {}) {
@ -1029,3 +1232,25 @@ export async function powerEffects (options = {}) {
} }
shim.notifications.error(`No power effect found for ${name}`) shim.notifications.error(`No power effect found for ${name}`)
} }
export async function shapeChangeOnDismiss (data) {
if (shim.user.id !== data.userId) { return }
const dismissedToken = data.actorData.prototypeToken
const flags = dismissedToken.flags['swade-mb-helpers']?.shapeChange
const srcTokenId = flags?.srcTokenId
if (!srcTokenId) { return }
const scene = shim.scenes.get(data.sceneId)
const token = scene.tokens.get(srcTokenId)
if (!token) { return }
const saved = token.flags['swade-mb-helpers']?.shapeChange?.saved
if (saved) {
const update = {
alpha: saved.alpha,
hidden: saved.hidden,
x: dismissedToken.x,
y: dismissedToken.y,
elevation: dismissedToken.elevation
}
await token.update(update)
}
}

View File

@ -33,18 +33,22 @@ export class shim {
return game.user.targets return game.user.targets
} }
static get notifications () {
return ui.notifications
}
static get user () { static get user () {
return game.user return game.user
} }
static get notifications () {
return ui.notifications
}
static get actors () { static get actors () {
return game.actors return game.actors
} }
static get scenes () {
return game.scenes
}
static mergeObject (...args) { static mergeObject (...args) {
return mergeObject(...args) return mergeObject(...args)
} }
@ -90,7 +94,7 @@ export class shim {
} }
const mutateOptions = { const mutateOptions = {
permanent: true, permanent: true,
description: effectDocuments[effectDocuments.length - 1] description: effectDocuments[effectDocuments.length - 1]?.name
} }
for (const effectDocument of effectDocuments) { for (const effectDocument of effectDocuments) {
mutation.embedded.ActiveEffect[effectDocument.name] = effectDocument mutation.embedded.ActiveEffect[effectDocument.name] = effectDocument
@ -106,6 +110,10 @@ export class shim {
return warpgate.spawn(...args) return warpgate.spawn(...args)
} }
static warpgateSpawnAt (...args) {
return warpgate.spawnAt(...args)
}
static getActorFolderByPath (path) { static getActorFolderByPath (path) {
const names = path.split('/') const names = path.split('/')
if (names[0] === '') { if (names[0] === '') {